<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
      xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="../../../assert/css/font.css" th:href="@{/assert/css/font.css}"/>
    <link rel="stylesheet" href="../../../assert/css/bootstrap.min.css" th:href="@{/assert/css/bootstrap.min.css}"/>
    <link rel="stylesheet" href="../../../assert/css/plugin/chosen/chosen.css"
          th:href="@{/assert/css/plugin/chosen/chosen.css}"/>
    <link rel="stylesheet" href="../../../assert/css/bootstrap-table.css" th:href="@{/assert/css/bootstrap-table.css}"/>
    <link rel="stylesheet" href="../../../assert/css/bootstrap-select.min.css"
          th:href="@{/assert/css/bootstrap-select.min.css}"/>
    <link href="../../../assert/css/animate.min.css" rel="stylesheet" th:href="@{/assert/css/animate.min.css}">
    <link href="../../../assert/css/plugin/toastr/toastr.min.css" rel="stylesheet"
          th:href="@{/assert/css/plugin/toastr/toastr.min.css}">
    <link href="../../../assert/css/plugin/jsTree/themes/default/style.css" rel="stylesheet"
          th:href="@{/assert/css/plugin/jsTree/themes/default/style.css}">
    <link href="../../../assert/css/loaders.css" rel="stylesheet"
          th:href="@{/assert/css/loaders.css}">
    <link rel="stylesheet" href="../../../assert/css/bootstrapValidator.css"
          th:href="@{/assert/css/bootstrapValidator.css}"/>
    <link rel="stylesheet" href="../../../assert/css/jquery-ui.css" th:href="@{/assert/css/jquery-ui.css}"/>
    <link href="../../../assert/js/lib/jqwidgets-ver4.0.0/jqwidgets/styles/jqx.base.css" rel="stylesheet"
          th:href="@{/assert/js/lib/jqwidgets-ver4.0.0/jqwidgets/styles/jqx.base.css}"/>
    <link rel="stylesheet" href="../../../assert/css/index.css" th:href="@{/assert/css/index.css(v_=${@commonController.getSysConfigByPK('CACHE_CODE')})}"/>
    <style>
        .search_group label.control-label{
            width:85px;
        }
    </style>
</head>
<body>
<div class="wrapper wrapper-content">
    <div class="ibox">
        <div class="tools_bar">
            <div class="pull-left">
                <a href="#" class="btn btn-default active" id="btnSearch" title="隐藏查询条"><i class="fa fa-filter"></i> 隐藏</a>
                <a href="#" class="btn btn-default active" id="refresh"><i class="fa fa-refresh"></i> 刷新</a>
                <a href="#" class="btn btn-default active" id="btnAdd" title="添加专项质检任务"><i class="fa fa-plus"></i>
                    添加</a>
                <a href="#" class="btn btn-default active" id="btnEdit" title="编辑专项质检任务"><i class="fa fa-pencil"></i>
                    编辑</a>
                <a href="#" class="btn btn-default active" id="btnDel" title="删除专项质检任务"><i class="fa fa-trash"></i>
                    删除</a>
                <a href="#" style="margin-left:20px;" class="btn btn-default active" id="btnStart" title="启动专项质检任务"><i
                        class="fa fa-power-off stateGreen"></i>
                    启动</a>
                <a href="#" class="btn btn-default active" id="btnStop" title="停止专项质检任务"><i class="fa fa-stop stateRed"></i>
                    停止</a>
            </div>
        </div>
        <div class="search on">
            <div class="search_group">
                <label class="control-label">省份：</label>
                <div class="control-inline">
                    <select type="text" id="pro"  class="form-control search_input selectpicker"></select>
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">任务名称：</label>
                <div class="control-inline">
                    <select type="text" id="taskName" class="form-control search_input selectpicker"></select>
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">创建人：</label>
                <div class="control-inline">
                    <input type="text" id="createP" value="" class="form-control search_input" autocomplete="off">
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">状态：</label>
                <div class="control-inline">
                    <select type="text" id="proStatus" value="" class="form-control search_input selectpicker"></select>
                </div>
            </div>

            <div class="search_group">
                <label class="control-label">通话时间段：</label>
                <div class="control-inline">
                    <input placeholder="开始日期" class="form-control layer-date search_input" id="start1" autocomplete="off"> -
                    <input placeholder="结束日期" class="form-control layer-date search_input" id="end1" autocomplete="off">
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">启动时间：</label>
                <div class="control-inline">
                    <input placeholder="开始日期" class="form-control layer-date search_input" id="start" autocomplete="off"> -
                    <input placeholder="结束日期" class="form-control layer-date search_input" id="end" autocomplete="off">
                </div>
            </div>
            <div class="search_group">
                <label class="control-label">创建时间：</label>
                <div class="control-inline">
                    <input placeholder="开始日期" class="form-control layer-date search_input" id="start2" autocomplete="off"> -
                    <input placeholder="结束日期" class="form-control layer-date search_input" id="end2" autocomplete="off">
                </div>
            </div>

            <div class="search_group">
                <button id="search" class="btn  btn-primary">查询</button>
                <button id="reset" class="btn  btn-default">重置</button>
                <button id="export" class="btn  btn-default hidden">导出</button>
            </div>
        </div>
        <table id="myTable"></table>
    </div>
</div>
<!--添加任务模态框-->
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static">
    <div class="modal-dialog" style="width:1000px !important;">
        <div class="modal-content">
            <form method="post" class="form-horizontal styleForm" id="addForm">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span
                            aria-hidden="true">&times;</span><span
                            class="sr-only">Close</span></button>
                    <h4 class="modal-title">添加专项质检任务</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <div class="form-box">
                            <label for="" class="form-title control-label"><span class="respan">*</span>省份:</label>
                            <div class="form-content">
                                <select name="" id="proModalAdd" class="selectpicker"></select>
                                <input type="text" class="form-control selectInput" id="proModalAddInput" autocomplete="off">
                            </div>
                        </div>
                        <div class="form-box">
                            <label for="" class="form-title control-label"><span class="respan">*</span>计分方式:</label>
                            <div class="form-content radio">
                                <label style="margin-right:20px;"><input type="radio" name="scoreFlag" value="0">录音</label>
                                <label><input type="radio" name="scoreFlag" value="1">任务</label>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="form-box tipInput">
                            <label for="" class="form-title control-label"><span class="respan">*</span>专项质检名称:</label>
                            <div class="form-content">
                                <input type="text" class="form-control" name="workName" id="workNameAdd" autocomplete="off" placeholder="请输入专项质检名称">
                                <span class="fa fa-exclamation-circle hidden tip" style="color: #f37428;"> 注：专项质检任务系统后台异步处理，请到质检结果查看。</span>
                            </div>
                        </div>
                        <div class="form-box">
                            <label for="" class="form-title control-label"><span class="respan">*</span>通话时间段:</label>
                            <div class="form-content">
                                <input placeholder="开始日期" class="form-control layer-date search_input" id="startTimeAdd"
                                       style="width:156px;" autocomplete="off"> -
                                <input placeholder="结束日期" class="form-control layer-date search_input" id="endTimeAdd"
                                       style="width:156px;" autocomplete="off">
                                <input type="text" class="form-control selectInput" id="timeModalAddInput">
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="form-box">
                            <label for="" class="form-title control-label">通话时长:</label>
                            <div class="form-content">
                                <input class="form-control layer-date search_input" style="width:138px;" id="durMin" placeholder="通话时长下限"> <span style="position:relative;top:6px;" autocomplete="off"> 秒 - </span>
                                <input class="form-control layer-date search_input" style="width:138px;" id="durMax" placeholder="通话时长上限"><span style="position:relative;top:6px;" autocomplete="off"> 秒</span>
                            </div>
                        </div>
                        <div class="form-box">
                            <label for="" class="form-title control-label">坐席组别:</label>
                            <div class="form-content">
                                <select name="" id="seatGroupModalAdd" class="selectpicker" multiple title="全部"></select>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="form-box">
                            <label for="" class="form-title control-label">坐席工号:</label>
                            <div class="form-content">
                                <input name="" id="seatIdModalAdd" class="form-control" autocomplete="off" placeholder="请输入坐席工号">
                            </div>
                        </div>
                        <div class="form-box">
                            <label for="" class="form-title control-label">客户号码:</label>
                            <div class="form-content">
                                <input type="text" class="form-control" id="customerNumAdd" autocomplete="off" placeholder="请输入客户号码">
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="form-box">
                            <label for="" class="form-title control-label">录音流水号:</label>
                            <div class="form-content">
                                <input type="text" class="form-control" id="serialNumberAdd" autocomplete="off" placeholder="请输入录音流水号">
                            </div>
                        </div>
                        <div class="form-box">
                            <label for="" class="form-title control-label">挂机方:</label>
                            <div class="form-content">
                                <select name="" id="onHookAdd" class="selectpicker" multiple title="全部"></select>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="form-box">
                            <label for="" class="form-title control-label">满意度:</label>
                            <div class="form-content">
                                <select name="" id="satisfactionAdd" class="selectpicker" multiple title="全部"></select>
                            </div>
                        </div>
                        <div class="form-box">
                            <label for="" class="form-title control-label">是否重复来电:</label>
                            <div class="form-content">
                                <select name="" id="reCallFlagAdd" class="selectpicker"></select>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="form-box">
                            <label for="" class="form-title control-label">客户星级:</label>
                            <div class="form-content">
                                <select name="" id="customerLevelAdd" class="selectpicker" multiple title="全部"></select>
                            </div>
                        </div>
                        <div class="form-box">
                            <label for="" class="form-title control-label">归属地:</label>
                            <div class="form-content">
                                <select name="" id="proCityAdd" class="selectpicker" multiple title="全部"></select>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="form-box">
                            <label for="" class="form-title control-label">呼叫类型:</label>
                            <div class="form-content">
                                <select name="" id="callDirectionAdd" class="selectpicker"></select>
                            </div>
                        </div>
                        <div class="form-box">
                            <label for="" class="form-title control-label">重要客户:</label>
                            <div class="form-content">
                                <select name="" id="customerSignAdd" class="selectpicker"></select>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="form-box">
                            <label for="" class="form-title control-label">话务小结:</label>
                            <div class="form-content">
                                <input type="text" id="tagTrafficAdd0" value="" class="form-control search_input tagName" autocomplete="off"  data-type="0" readonly>
                            </div>
                        </div>
                        <div class="form-box">
                            <label for="" class="form-title control-label">系统标签:</label>
                            <div class="form-content">
                                <input type="text" id="tagTrafficAdd1" value="" class="form-control search_input tagName" autocomplete="off" data-type="1" readonly>
                            </div>
                        </div>
                    </div>
                    <div class="form-group remarkBox">
                        <label for="" class="control-label form-title">备注:</label>
                        <div class="form-content-row">
                            <textarea class="form-control" style="height:70px;" id="descriptionAdd" placeholder="最多输入255个字符"></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="form-title control-label"><span class="respan">*</span>质检模型:</label>
                        <div class="form-content-row">
                            <button class="btn btn-primary" type="button" id="addModelWinBtn"><i class="fa fa-plus"></i>选择模型
                            </button>
                            <div class="rule_box">
                                <div class="table_msg">
                                    <ul>
                                        <li>已选择模型: <span id="modelNum">0</span></li>
                                    </ul>
                                </div>
                                <table id="modelTable"></table>
                            </div>

                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" id="addSave">保存</button>
                    <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                </div>
            </form>
        </div>
    </div>
</div>
<!--编辑任务模态框-->
<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static">
    <div class="modal-dialog" style="width:1000px !important;">
        <div class="modal-content">
            <form method="post" class="form-horizontal styleForm" id="editForm">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span
                            aria-hidden="true">&times;</span><span
                            class="sr-only">Close</span></button>
                    <h4 class="modal-title">编辑专项质检任务</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <div class="form-box">
                            <label for="" class="form-title control-label"><span class="respan">*</span>省份:</label>
                            <div class="form-content form-group">
                                <select name="provinceCode" id="proModalEdit" class="selectpicker"></select>
                                <input type="text" class="form-control selectInput" id="proModalEditInput" autocomplete="off">
                            </div>
                        </div>
                        <div class="form-box">
                            <label for="" class="form-title control-label"><span class="respan">*</span>计分方式:</label>
                            <div class="form-content radio">
                                <label style="margin-right:20px;"><input type="radio" name="scoreFlagEdit" value="0">录音</label>
                                <label><input type="radio" name="scoreFlagEdit" value="1">任务</label>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="form-box tipInput">
                            <label for="" class="form-title control-label"><span class="respan">*</span>专项质检名称:</label>
                            <div class="form-content form-group">
                                <input type="text" class="form-control" name="workName" id="workNameEdit" autocomplete="off" placeholder="请输入专项质检名称">
                                <span class="fa fa-exclamation-circle hidden tip" style="color: #f37428;"> 注：专项质检任务系统后台异步处理，请到质检结果查看。</span>
                            </div>
                        </div>
                        <div class="form-box">
                            <label for="" class="form-title control-label"><span class="respan">*</span>通话时间段:</label>
                            <div class="form-content form-group">
                                <input placeholder="开始日期" class="form-control layer-date search_input"
                                       id="startTimeEdit" style="width:156px;" name="callStartTime1" autocomplete="off"> -
                                <input placeholder="结束日期" class="form-control layer-date search_input" id="endTimeEdit"
                                       style="width:156px;" name="callEndTime1" autocomplete="off">
                                <input type="text" class="form-control selectInput" id="timeModalEditInput">
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="form-box">
                            <label for="" class="form-title control-label">通话时长:</label>
                            <div class="form-content form-group">
                                <input class="form-control layer-date search_input" style="width:138px;" id="durMinEdit"  name="minDuration" autocomplete="off" placeholder="通话时长下限"> <span style="position:relative;top:6px;"> 秒 - </span>
                                <input class="form-control layer-date search_input" style="width:138px;" id="durMaxEdit" name="maxDuration" autocomplete="off" placeholder="通话时长上限"><span style="position:relative;top:6px;"> 秒</span>
                            </div>
                        </div>
                        <div class="form-box">
                            <label for="" class="form-title control-label">坐席组别:</label>
                            <div class="form-content">
                                <select name="seatGroupIds" id="seatGroupModalEdit" class="selectpicker" multiple title="全部"></select>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="form-box">
                            <label for="" class="form-title control-label">坐席工号:</label>
                            <div class="form-content">
                                <input name="seatIds" id="seatIdModalEdit" class="form-control" autocomplete="off" placeholder="请输入坐席工号">
                            </div>
                        </div>
                        <div class="form-box">
                            <label for="" class="form-title control-label">客户号码:</label>
                            <div class="form-content">
                                <input type="text" class="form-control" id="customerNumEdit" name="customerNums" autocomplete="off" placeholder="请输入客户号码">
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="form-box">
                            <label for="" class="form-title control-label">录音流水号:</label>
                            <div class="form-content">
                                <input type="text" class="form-control" id="serialNumberEdit" name="serialNumbers" autocomplete="off" placeholder="请输入录音流水号">
                            </div>
                        </div>
                        <div class="form-box">
                            <label for="" class="form-title control-label">挂机方:</label>
                            <div class="form-content">
                                <select name="onHooks" id="onHookEdit" class="selectpicker" multiple title="全部"></select>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="form-box">
                            <label for="" class="form-title control-label">满意度:</label>
                            <div class="form-content">
                                <select name="satisfaction" id="satisfactionEdit" class="selectpicker" multiple title="全部"></select>
                            </div>
                        </div>
                        <div class="form-box">
                            <label for="" class="form-title control-label">是否重复来电:</label>
                            <div class="form-content">
                                <select name="reCallFlag" id="reCallFlagEdit" class="selectpicker"></select>
                            </div>
                        </div>

                    </div>
                    <div class="form-group">
                        <div class="form-box">
                            <label for="" class="form-title control-label">客户星级:</label>
                            <div class="form-content">
                                <select name="" id="customerLevelEdit" class="selectpicker" multiple title="全部"></select>
                            </div>
                        </div>
                        <div class="form-box">
                            <label for="" class="form-title control-label">归属地:</label>
                            <div class="form-content">
                                <select name="" id="proCityEdit" class="selectpicker" multiple title="全部"></select>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="form-box">
                            <label for="" class="form-title control-label">呼叫类型:</label>
                            <div class="form-content">
                                <select id="callDirectionEdit" name="callDirection" class="selectpicker"></select>
                            </div>
                        </div>
                        <div class="form-box">
                            <label for="" class="form-title control-label">重要客户:</label>
                            <div class="form-content">
                                <select  id="customerSignEdit" name="customerSign" class="selectpicker"></select>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="form-box">
                            <label for="" class="form-title control-label">话务小结:</label>
                            <div class="form-content">
                                <input type="text" id="tagTrafficEdit0" value="" name="callTags" class="form-control search_input tagName" autocomplete="off"  data-type="0" readonly>
                            </div>
                        </div>
                        <div class="form-box">
                            <label for="" class="form-title control-label">系统标签:</label>
                            <div class="form-content">
                                <input type="text" id="tagTrafficEdit1" value=""  name="sysTags" class="form-control search_input tagName" autocomplete="off" data-type="1" readonly>
                            </div>
                        </div>
                    </div>
                    <div class="form-group remarkBox">
                        <label for="" class="control-label form-title">备注:</label>
                        <div class="form-content-row">
                            <textarea class="form-control" style="height:70px;" id="descriptionEdit"
                                      name="description"  placeholder="最多输入255个字符"></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="form-title control-label"><span class="respan">*</span>质检模型:</label>
                        <div class="form-content-row">
                            <button class="btn btn-primary" type="button" id="editModelWinBtn"><i
                                    class="fa fa-plus"></i>选择模型
                            </button>
                            <div class="rule_box">
                                <div class="table_msg">
                                    <ul>
                                        <li>已选择模型: <span id="modelNumEdit">0</span></li>
                                    </ul>
                                </div>
                                <table id="modelTableEdit"></table>
                            </div>

                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" id="editSave">保存</button>
                    <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                </div>
            </form>
        </div>
    </div>
</div>
<!--启动/停止确认框-->
<div class="modal fade" id="startModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content">
            <form method="post">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span
                            aria-hidden="true">&times;</span><span
                            class="sr-only">Close</span></button>
                    <h4 class="modal-title">启动</h4>
                </div>
                <div class="modal-body">
                    <div style="text-align: center">
                        <span class="fa fa-question-circle"></span>
                        <span id="type"></span>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" id="startBtn">确定</button>
                    <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                </div>
            </form>
        </div>
    </div>
</div>
<!--删除确认框-->
<div class="modal fade" id="delModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content">
            <form method="post">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span
                            aria-hidden="true">&times;</span><span
                            class="sr-only">Close</span></button>
                    <h4 class="modal-title">删除</h4>
                </div>
                <div class="modal-body">
                    <div style="text-align: center"><span class="fa fa-question-circle"></span><span
                            id="delName"></span>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" id="delBtn">确定</button>
                    <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                </div>
            </form>
        </div>
    </div>
</div>
<!--添加质检模型框-->
<div class="modal fade" id="addModelModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static">
    <div class="modal-dialog" style="width:1000px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span
                        aria-hidden="true">&times;</span><span
                        class="sr-only">Close</span></button>
                <h4 class="modal-title">添加模型</h4>
            </div>
            <div class="modal-body" style="display: inline-block;width:100%;">
                <div class="selectModel">
                    <div class="menu_left">
                        <div class="search_box">
                            <input type="text" autocomplete="off"><span class="fa fa-search fa_btn" id="searchMenu"></span>
                        </div>
                        <div id="jstree" class="scrollbar">

                        </div>
                    </div>
                    <div class="model_right" style="width:758px;">
                        <table id="modelTableWin"></table>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" id="selectModel">确定</button>
<!--                <button type="button" class="btn btn-white" id="resetModel">重置</button>-->
                <button type="button" class="btn btn-white closeSelectModel" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
<!--编辑确认框（任务质检中）-->
<div class="modal fade" id="editConModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content">
            <form method="post">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span
                            aria-hidden="true">&times;</span><span
                            class="sr-only">Close</span></button>
                    <h4 class="modal-title">确认编辑</h4>
                </div>
                <div class="modal-body">
                    <div style="text-align: center"><span class="fa fa-question-circle"></span>所选任务质检中，只能编辑名称，若编辑，可能会出现数据不一致，您确定继续编辑吗？
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" id="editConBtn">确定</button>
                    <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                </div>
            </form>
        </div>
    </div>
</div>
<!--查看任务条件模态框-->
<div class="modal fade" id="lookModal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static">
    <div class="modal-dialog" style="width:900px !important;">
        <div class="modal-content">
            <form method="post" class="form-horizontal styleForm" id="lookForm">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span
                            aria-hidden="true">&times;</span><span
                            class="sr-only">Close</span></button>
                    <h4 class="modal-title">查看<span id="lookId"></span>任务条件</h4>
                </div>
                <div class="modal-body">
                    <div class="auditRow">
                        <div class="auditBox">
                            <label for="">省份</label>
                            <input type="text" style="width: 270px;" readonly id="lookPro">
                        </div>
                        <div class="auditBox" >
                            <label for="" style="width: 164px;">计分方式</label>
                            <input type="text" style="width: 270px;" readonly id="lookSorce">
                        </div>
                    </div>
                    <div class="auditRow">
                        <div class="auditBox">
                            <label for="">通话时间段</label>
                            <input type="text" style="width: 270px;" readonly id="lookTime">
                        </div>
                        <div class="auditBox">
                            <label for="" style="width: 164px;">通话时长</label>
                            <input type="text" style="width: 270px;" readonly id="lookPhoneTime">
                        </div>
                    </div>
                    <div class="auditRow">
                        <div class="auditBox">
                            <label for="" >录音流水号</label>
                            <input type="text" style="width: 270px;" readonly id="lookSerialNumber">
                        </div>
                        <div class="auditBox">
                            <label for=""  style="width: 164px;">坐席组别</label>
                            <input type="text" style="width: 270px;" readonly id="lookSeatGroup">
                        </div>
                    </div>
                    <div class="auditRow">
                        <div class="auditBox">
                            <label for="">坐席工号</label>
                            <input type="text" style="width: 270px;" readonly id="lookSeatId">
                        </div>
                        <div class="auditBox">
                            <label for="" style="width: 164px;">客户号码</label>
                            <input type="text" style="width: 270px;" readonly id="lookPhone">
                        </div>
                    </div>
                    <div class="auditRow">
                        <div class="auditBox">
                            <label for="">是否重复来电</label>
                            <input type="text" style="width: 270px;" readonly id="lookRepeate">
                        </div>
                        <div class="auditBox">
                            <label for="" style="width: 164px;">挂机方</label>
                            <input type="text" style="width: 270px;" readonly id="lookHook">
                        </div>
                    </div>
                    <div class="auditRow">
                        <div class="auditBox">
                            <label for="">满意度</label>
                            <input type="text" style="width: 270px;" readonly id="lookAgree">
                        </div>
                        <div class="auditBox">
                            <label for="" style="width: 164px;">客户星级</label>
                            <input type="text" style="width: 270px;" readonly id="lookCustomerLevel">
                        </div>
                    </div>
                    <div class="auditRow">
                        <div class="auditBox">
                            <label for="">归属地</label>
                            <input type="text" style="width: 270px;" readonly id="lookProCity">
                        </div>
                        <div class="auditBox">
                            <label for="" style="width: 164px;">呼叫类型</label>
                            <input type="text" style="width: 270px;" readonly id="lookCallDirection">
                        </div>
                    </div>
                    <div class="auditRow">
                        <div class="auditBox">
                            <label for="">重要客户</label>
                            <input type="text" style="width: 270px;" readonly id="lookCustomerSign">
                        </div>
                        <div class="auditBox">
                            <label for="" style="width: 164px;">话务小结</label>
                            <input type="text" style="width: 270px;" readonly id="lookCallTags">
                        </div>
                    </div>
                    <div class="auditRow">
                        <div class="auditBox">
                            <label for="">系统标签</label>
                            <input type="text" style="width: 270px;" readonly id="lookSysTags">
                        </div>
                    </div>
                    <div class="auditRow">
                        <div class="auditBox">
                            <label for="">备注</label>
                            <input type="text" style="width: 708px;" readonly id="lookRemark">
                        </div>
                    </div>
                    <div class="auditRow">
                        <div class="auditBox" style="float: right; margin-right: 60px;">
                            <!--<label for="">质检模型</label>-->
                            <table id="modelTableLook" style="width: 708px;"></table>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                </div>
            </form>
        </div>
    </div>
</div>
<a id="basePath" th:href="@{/}"></a>
<input type="text" id="classify" class="hidden">
<input type="text" id="proSelectModal" class="hidden">
<input type="text" id="ruleId" class="hidden">
<input type="hidden" id="tagTreeId" value="" class="form-control search_input">
<input type="hidden" id="areaTreeId" value="" class="form-control search_input">
<input type="hidden" id="tagTreeType" value="" class="form-control search_input">
<input type="hidden" id="tagProperty" value="" class="form-control search_input">
<script src="../../../assert/js/jquery.js" th:src="@{/assert/js/jquery.js(v_=${@commonController.getSysConfigByPK('CACHE_CODE')})}"></script>
<script src="../../../assert/js/bootstrap.min.js" th:src="@{/assert/js/bootstrap.min.js(v_=${@commonController.getSysConfigByPK('CACHE_CODE')})}"></script>
<script src="../../../assert/js/plugin/bootstrap-table/bootstrap-table.min.js"
        th:src="@{/assert/js/plugin/bootstrap-table/bootstrap-table.min.js(v_=${@commonController.getSysConfigByPK('CACHE_CODE')})}"></script>
<script src="../../../assert/js/plugin/bootstrap-table/bootstrap-table-mobile.min.js"
        th:src="@{/assert/js/plugin/bootstrap-table/bootstrap-table-mobile.min.js}"></script>
<script src="../../../assert/js/plugin/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"
        th:src="@{/assert/js/plugin/bootstrap-table/locale/bootstrap-table-zh-CN.min.js}"></script>
<script src="../../../assert/js/bootstrap-select.js" th:src="@{/assert/js/bootstrap-select.js}"></script>
<script src="../../../assert/js/bootstrapValidator.js" th:src="@{/assert/js/bootstrapValidator.js}"></script>
<script src="../../../assert/js/plugin/toastr/toastr.min.js"
        th:src="@{/assert/js/plugin/toastr/toastr.min.js}"></script>
<script src="../../../assert/js/base.js" th:src="@{/assert/js/base.js(v_=${@commonController.getSysConfigByPK('CACHE_CODE')})}"></script>
<script src="../../../assert/js/jquery-ui.min.js" th:src="@{/assert/js/jquery-ui.min.js}"></script>
<script src="../../../assert/js/plugin/layer/laydate/laydate.js"
        th:src="@{/assert/js/plugin/layer/laydate/laydate.js}"></script>
<script src="../../../assert/js/changeTime.js" th:src="@{/assert/js/changeTime.js(v_=${@commonController.getSysConfigByPK('CACHE_CODE')})}"></script>
<script src="../../../assert/js/plugin/jsTree/jstree.min.js"
        th:src="@{/assert/js/plugin/jsTree/jstree.min.js}"></script>
<script src="../../../assert/js/plugin/chosen/chosen.jquery.js"
        th:src="@{/assert/js/plugin/chosen/chosen.jquery.js}"></script>
<script src="../../../assert/js/common.js" th:src="@{/assert/js/common.js(v_=${@commonController.getSysConfigByPK('CACHE_CODE')})}"></script>
<script src="../../../assert/js/lib/jqwidgets-ver4.0.0/jqwidgets/jqxcore.js"
        th:src="@{/assert/js/lib/jqwidgets-ver4.0.0/jqwidgets/jqxcore.js}"></script>
<script src="../../../assert/js/lib/jqwidgets-ver4.0.0/jqwidgets/jqxvalidator.js"
        th:src="@{/assert/js/lib/jqwidgets-ver4.0.0/jqwidgets/jqxvalidator.js}"></script>
<script src="../../../assert/js/taskCommon.js" th:src="@{/assert/js/taskCommon.js(v_=${@commonController.getSysConfigByPK('CACHE_CODE')})}"></script>
<script src="../../../assert/js/contabs.min.js" th:src="@{/assert/js/contabs.min.js(v_=${@commonController.getSysConfigByPK('CACHE_CODE')})}"></script>
<script>
    //项目名称
    var basePath = $("#basePath").attr("href");
    var json = [];
    //    页面主表格
    var TableInit = function () {
        var oTableInit = new Object();
        var url = basePath + "/rest/per-task/get-data-list";
        var height = ($(window).height() -$(".tools_bar").height()-9-$(".search").height()-40);
        //初始化Table
        oTableInit.Init = function () {
            $('#myTable').bootstrapTable({
//                toolbar: '#tools_bar',                //工具按钮用哪个容器
//                data:json,
                url: url,         //请求后台的URL（*）
                method: 'post',                      //请求方式（*）
                cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
                sortable: true,                     //是否启用排序
                sortName: "lastUpdateTime", //排序方式
                sortOrder: "desc",
                height:height,
//                rememberOrder:true,
//                showMultiSort:true,
//                showMultiSortButton:true,
//                sortPriority:[
//                    {"sortName":"provinceCode","sortOrder":"asc"},
//                    {"sortName":"onsetTime","sortOrder":"desc"},
//                    {"sortName":"lastUpdateTime","sortOrder":"desc"}
//                ],
                pagination: true,    //排序方式
                queryParams: oTableInit.queryParams,//传递参数（*）
                responseHandler: function (res) {
                    if (res.code != 0) {
                        toastrCog.error(res.msg, 3000);
                    }
                    return {
                        "total": res.count,//总页数
                        "rows": res.data   //数据
                    };
                },
                sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
                pageNumber: 1,                       //初始化加载第一页，默认第一页
                pageSize: 10,                       //每页的记录行数（*）
                pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
                search: false,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
                contentType: "application/x-www-form-urlencoded",
                strictSearch: true,
                showColumns: false,                  //是否显示所有的列
                showRefresh: false,                  //是否显示刷新按钮
                minimumCountColumns: 2,             //最少允许的列数
                clickToSelect: true,                //是否启用点击选中行
                uniqueId: "no",                     //每一行的唯一标识，一般为主键列
                showToggle: false,                    //是否显示详细视图和列表视图的切换按钮
                cardView: false,                    //是否显示详细视图
                detailView: true,
                cellStyle: {
                    css: {"background-color": "#fff"}
                },//是否显示父子表
                columns: [
                    {
                        checkbox: true, // 显示一个勾选框
                        align: 'center' // 居中显示
                    },
                    {
                        align: "center",
                        halign: "center",
                        title: '序号',//标题  可不加
                        width: 60,
                        field: 'id',
                        formatter: function (value, row, index) {
                            var getOptions = $("#myTable").bootstrapTable('getOptions');
                            var pagenum = getOptions.pageNumber;
                            var pagesize = getOptions.pageSize;
                            var st = (pagenum - 1) * pagesize;
                            return (st + index + 1) + "";
                        }
                    },
                    {
                        align: "center",
                        halign: "center",
                        field: 'provinceCode',
                        title: '省份',
//                        sortName:"provinceCode",
                        sortable: true,
                        formatter:function(value, row, index){
                            return  bs.getXInY(tools.proArr, "name", "value", value)
                        }
                    },
                    {
                        align: "center",
                        halign: "center",
                        field: 'workName',
                        title: '专项质检任务名称',
                        sortable: true,
                        formatter: function (value, row, index) {
                            var rowStr=JSON.stringify(row);
                            var html="<div class='fileNameLook' data-id='" + row.id + "' data-row='"+rowStr+"'>" + value + "</div>";
                            return  html;
                        }
                    },
                    {
                        align: "center",
                        halign: "center",
                        field: 'proStatus',
                        title: '状态',
                        width: 80,
                        sortable: true,
                        formatter: function (value, row, index) {
                            var str="";
                            var color = "#000";
                            if(value=="1"){
                                color = "stateGreen";
                            }
                            str=bs.changeState(value, tools.stateArr);
                            return "<span class='" + color + "'>" + str + "</span>";
                        }
                    },
                    {
                        align: "center",
                        halign: "center",
                        field: 'processed',
                        title: '已质检话务量',
                        sortable: true,
                        width: 80
                    },
                    {
                        align: "center",
                        halign: "center",
                        field: 'createusername',
                        title: '创建人',
                        sortable: true,
//                        formatter:function(value, row, index){
//                            return  tools.getNameInId(value)
//                        }
                    }, {
                        align: "center",
                        halign: "center",
                        field: 'createTime',
                        title: '创建时间',
                        sortable: true,
//                        sortName:"onsetTime",
                        formatter: function (value, row, index) {
                            return dateFormatUtil(value);
                        }
                    },{
                        align: "center",
                        halign: "center",
                        field: 'callStartTime',
                        title: '通话时间段',
                        sortable: true,
                        formatter: function (value, row, index) {
                            var start = dateFormatUtil(row.callStartTime);
                            var end = dateFormatUtil(row.callEndTime);
                            return start + " - " + end;
                        }
                    }, {
                        align: "center",
                        halign: "center",
                        field: 'onsetTime',
                        title: '启动时间',
                        sortable: true,
//                        sortName:"onsetTime",
                        formatter: function (value, row, index) {
                            return dateFormatUtil(value);
                        }
                    }, {
                        align: "center",
                        halign: "center",
                        field: 'lastUpdateTime',
                        title: '最后更新时间',
//                        sortName:"lastUpdateTime",
                        sortable: true,
                        formatter: function (value, row, index) {
                            return dateFormatUtil(value);
                        }
                    }, {
                        align: "center",
                        halign: "center",
                        field: 'description',
                        title: '备注',
                        formatter: function (value, row, index) {
                            if(value == null){
                                value=""
                            }
                            return "<div class='noteBoxTable' title='"+value+"'>"+value+"</div>";
                        }
                    },
                    {
                        field: 'Button',
                        title: '操作',
                        formatter: function (value, row, index) {
                            var pro = row.provinceCode;
                            var workId = row.id;
                            var proStatus = row.proStatus;
                            var params = {
                                workId: workId,
                                pro: pro
                            };
                            var href = basePath + "/rest/page/ruleStatistic?" + $.param(params);
                            var aIndex=parent.$(".J_menuTab.active").attr("data-index");
                            if(proStatus != 0){
                                return [
                                    '<a href="' + href + '" class="fa fa-eye lookDetail handleBtn J_menuItem" title="查看规则命中详情" data-href="rest/page/ruleStatistic" data-index="规则统计1" data-txt="规则命中详情"></a>'
                                ]
                            }
                        },
                        events: {
                            'click .lookDetail': function (e, value, row, index) {

                            }
                        }
                    }
                ],
                onResetView:function(){

                },
                onLoadSuccess: function (data) {  //加载成功时执行
                    resize.me();
                    if (!data.rows||data.rows.length == 0) {
                        var src=basePath+"/assert/image/nodata.png";
                        $("#myTable .no-records-found").find("td").html('<img src="'+src+'" th:src="@{/assert/image/nodata.png}" style="width:165px;" alt="">');
                    }
                },
                onLoadError: function () {  //加载失败时执行
                    var src=basePath+"/assert/image/nodata.png";
                    $("#myTable .no-records-found").find("td").html('<img src="'+src+'" th:src="@{/assert/image/nodata.png}" style="width:165px;" alt="">');
                },
                formatLoadingMessage: function () {
                    return '<div class="loaded">' +
                        '<div class="loader">' +
                        '<div class="loader-inner line-scale-pulse-out">' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '</div>' +
                        '</div>' +
                        '</div>' +
                        '<div>请稍等，数据正在加载中...</div>';
                },
                formatMultipleSort: function () {
                   return "排序"
                },
                formatAddLevel: function () {
                    return "添加排序"
                },
                formatDeleteLevel: function () {
                    return "删除排序"
                },
                formatColumn: function () {
                    return "列名称"
                },
                formatOrder: function () {
                    return "排序方式"
                },
                formatSortBy: function () {
                    return "先按"
                },
                formatThenBy: function () {
                    return "然后按"
                },
                formatSort: function () {
                    return "保存"
                },
                formatCancel: function () {
                    return "关闭"
                },
                formatSortOrders: function () {
                    return {"asc":"正序","desc":"倒序"}
                },
                onExpandRow: function (index, row, $detail) {
                    //这一步就是相当于在当前点击列下新创建一个table
                    row.subDataArr=row.models;
                    InitSubTable(index,row.subDataArr, $detail);
                }
            });
        };
        //得到查询的参数
        oTableInit.queryParams = function (params) {
            var temp = {   //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
                pageNum: params.offset/params.limit,   //页面大小
                pageSize: params.limit,
                sortName: this.sortName,
                sortOrder: this.sortOrder,
                provinceCode: $("#pro").val(),
                workId: $("#taskName").val(),
                workType: 1,
                createUserId: bs.getXInY(tools.seatAllArr,"id","userName",$("#createP").val()),
                proStatus: $("#proStatus").val(),
                callStartTime: $("#start1").val(),
                callEndTime: $("#end1").val(),
                onsetTimeBegin: $("#start").val(),
                onsetTimeEnd: $("#end").val(),
                createTimeBegin: $("#start2").val(),
                createTimeEnd: $("#end2").val(),
            };
            return temp;
        };
        //初始化子表格(无线循环)
        InitSubTable = function (index, row, $detail) {
            var parentid = row.id;
            var cur_table = $detail.html('<table></table>').find('table');
            $(cur_table).bootstrapTable({
                data: row,
                queryParams: {strParentID: parentid},
                ajaxOptions: {strParentID: parentid},
                clickToSelect: true,
                uniqueId: "id",
                pageSize: 10,
                pageList: [10, 25],
                columns: [
                    {
                        title: '序号',//标题  可不加
                        field: 'id',
                        width: 60,
                        formatter: function (value, row, index) {
                            return index + 1
                        }
                    },
                    {
                        field: 'modelName',
                        title: '模型名称',
                        formatter: function (value, row, index) {
                            return '<a href="javascript:;" class="commonDetail" data-type="model" title="查看模型信息">'+value+'</a>';
                        },
                        events: {
                            'click .commonDetail': function (e, value, row, index) {
                                var type=$(this).attr("data-type");
                                var param={};
                                param.modelId=row.modelId;
                                modelRule.init($("body"),type,param);
                            }
                        }
                    },
                    {
                        field: 'ruleTypeName',
                        title: '规则分类'
                    },
                    {
                        field: 'ruleName',
                        title: '规则名称',
                        formatter: function (value, row, index) {
                            return '<a href="javascript:;" class="commonDetail" data-type="rule" title="查看规则信息">'+value+'</a>';
                        },
                        events: {
                            'click .commonDetail': function (e, value, row, index) {
                                var type=$(this).attr("data-type");
                                var param={};
                                param.idcombinationRule=row.ruleId;
                                modelRule.init($("body"),type,param);
                            }
                        }
                    }
                ],
                onLoadSuccess: function (data) {  //加载成功时执行
                    if (!data.total || data.total == 0) {
                        var src = basePath + "/assert/image/nodata.png";
                        $(".no-records-found").find("td").html('<img src="' + src + '" th:src="@{/assert/image/nodata.png}" style="width:165px;" alt="">');
                    }
                },
                onLoadError: function () {  //加载失败时执行
                    var src = basePath + "/assert/image/nodata.png";
                    $(".no-records-found").find("td").html('<img src="' + src + '" th:src="@{/assert/image/nodata.png}" style="width:165px;" alt="">');
                },
                formatLoadingMessage: function () {
                    return '<div class="loaded">' +
                        '<div class="loader">' +
                        '<div class="loader-inner line-scale-pulse-out">' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '</div>' +
                        '</div>' +
                        '</div>' +
                        '<div>请稍等，数据正在加载中...</div>';
                }
            });
        };
        return oTableInit;
    };
    //    添加录音的表格
    var TableInit1 = function () {
        var oTableInit1 = new Object();
        var url = basePath + "/rest/handle/getTTSCapacity";
        //初始化Table
        oTableInit1.Init = function () {
            $('#audioTable').bootstrapTable("destroy")
            $('#audioTable').bootstrapTable({
//                toolbar: '#tools_bar',                //工具按钮用哪个容器
                data: json,
//                url: url,         //请求后台的URL（*）
//                method: 'get',                      //请求方式（*）
                cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
                sortable: true,                     //是否启用排序
                sortOrder: "asc",                   //排序方式
//                responseHandler: function (res) {
//                    return {
//                        "total": res.result.length,//总页数
//                        "rows": res.result   //数据
//                    };
//                },
                sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
                pageNumber: 1,                       //初始化加载第一页，默认第一页
                pageSize: 10,                       //每页的记录行数（*）
                pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
                search: false,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
                contentType: "application/x-www-form-urlencoded",
                strictSearch: true,
                showColumns: false,                  //是否显示所有的列
                showRefresh: false,                  //是否显示刷新按钮
                minimumCountColumns: 2,             //最少允许的列数
                clickToSelect: false,                //是否启用点击选中行
                uniqueId: "no",                     //每一行的唯一标识，一般为主键列
                showToggle: false,                    //是否显示详细视图和列表视图的切换按钮
                cardView: false,                    //是否显示详细视图
                detailView: false,
                cellStyle: {
                    css: {"background-color": "#fff"}
                },//是否显示父子表
                columns: [
                    {
                        title: '序号',//标题  可不加
                        field: 'id',
                        width: 60
                    },
                    {
                        field: 'serialNumber',
                        title: '录音流水号'
                    },
                    {
                        field: 'customerNumber',
                        title: '客户号码'
                    }, {
                        field: 'seatGroup',
                        title: '坐席组别'
                    },
                    {
                        field: 'seatId',
                        title: '坐席工号'
                    }, {
                        field: 'callDirection',
                        title: '通话类型'
                    }, {
                        field: 'holdDuration',
                        title: '通话时长(s)'
                    }, {
                        field: 'callStartTime',
                        title: '通话开始时间'
                    }, {
                        field: 'callEndTime',
                        title: '通话结束时间'
                    }
                ],
                onLoadSuccess: function (data) {  //加载成功时执行
                    if (!data.total||data.total == 0) {
                        var src=basePath+"/assert/image/nodata.png";
                        $(".no-records-found").find("td").html('<img src="'+src+'" th:src="@{/assert/image/nodata.png}" style="width:165px;" alt="">');
                    }
                },
                onLoadError: function () {  //加载失败时执行
                    var src=basePath+"/assert/image/nodata.png";
                    $(".no-records-found").find("td").html('<img src="'+src+'" th:src="@{/assert/image/nodata.png}" style="width:165px;" alt="">');
                },
                formatLoadingMessage: function () {
                    return '<div class="loaded">' +
                        '<div class="loader">' +
                        '<div class="loader-inner line-scale-pulse-out">' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '</div>' +
                        '</div>' +
                        '</div>' +
                        '<div>请稍等，数据正在加载中...</div>';
                }
            });
        };
        return oTableInit1;
    };
    //    弹出框模型选择的表格
    var TableInit2 = function () {
        var oTableInit2 = new Object();
        var url = basePath + "rest/model/select/byMutiConditionAndPagenationAndMutilTable";
        //初始化Table
        oTableInit2.Init = function () {
            $('#modelTableWin').bootstrapTable("destroy");
            $('#modelTableWin').bootstrapTable({
//                toolbar: '#tools_bar',                //工具按钮用哪个容器
                url: url,         //请求后台的URL（*）
                method: 'get',                      //请求方式（*）
                cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
                sortable: true,                     //是否启用排序
                sortOrder: "asc",                   //排序方式
                responseHandler: function (res) {
                    json = res.data;
                    return {
                        "total": res.count,//总页数
                        "rows": res.data   //数据
                    };
                },
                pagination: true, // 是否显示分页（*）
                sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
                pageNumber: 1,                       //初始化加载第一页，默认第一页
                pageSize: 10,                       //每页的记录行数（*）
                pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
                search: false,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
                contentType: "application/x-www-form-urlencoded",
                strictSearch: true,
                showColumns: false,                  //是否显示所有的列
                showRefresh: false,                  //是否显示刷新按钮
                minimumCountColumns: 2,             //最少允许的列数
                clickToSelect: true,                //是否启用点击选中行
                singleSelect: true,                //是否启用点击选中行
                uniqueId: "no",                     //每一行的唯一标识，一般为主键列
                showToggle: false,                    //是否显示详细视图和列表视图的切换按钮
                cardView: false,                    //是否显示详细视图
                detailView: true,
                cellStyle: {
                    css: {"background-color": "#fff"}
                },//是否显示父子表
                queryParams: function (params) {
                    var temp = {   //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
                        // rows: params.limit,//页面大小
                        // page: (params.offset / params.limit) + 1//页码
                        limit: params.limit,   //页面大小
                        offset: params.offset,  //偏移量
                        classify:$("#classify").val(), //分类
                        provincecode:$("#proSelectModal").val(),
                        person: "", //创建人
                        modelname: "",//名称
                        keyinclude: "",//关键词
                        state: 1,//状态
                        start: "",//开始日期
                        end: "" //结束日期
                    };
                    return temp;
                },
                columns: [
                    {
                        checkbox: true, // 显示一个勾选框
                        align: 'center' // 居中显示
                    },
                    {
                        title: '序号',//标题  可不加
                        field: 'id',
                        width: 60,
                        formatter: function (value, row, index) {
                            var getOptions = $("#modelTableWin").bootstrapTable('getOptions');
                            var pagenum = getOptions.pageNumber;
                            var pagesize = getOptions.pageSize;
                            var st = (pagenum - 1) * pagesize;
                            return (st + index + 1) + "";
                        }
                    },
                    {
                        field: 'name',
                        title: '模型名称'
                    },
                    {
                        field: 'note',
                        title: '备注',
                        formatter: function (value, row, index) {
                            if(value == null){
                                value=""
                            }
                            return "<div class='noteBoxTable' title='"+value+"'>"+value+"</div>";
                        }
                    }
                ],
                onLoadSuccess: function (data) {  //加载成功时执行
                    resize.me();
                    var src=basePath+"/assert/image/nodata.png";
                    if (!data.total||data.total == 0) {
                        $("#modelTableWin  .no-records-found").find("td").html('<img src="'+src+'" th:src="@{/assert/image/nodata.png}" style="width:165px;" alt="">');
                    }
                },
                onLoadError: function () {  //加载失败时执行
//                    toastr.error('加载数据失败！');
                    var src=basePath+"/assert/image/nodata.png";
                    $("#modelTableWin .no-records-found").find("td").html('<img src="'+src+'" th:src="@{/assert/image/nodata.png}" style="width:165px;" alt="">');
                },
                onCheck: function (row, tr) {
                    tools.modelSelectArr=[];
                    tools.modelSelectArr.push(row);
                },
                onUncheck: function (row, tr) {
                    tools.modelSelectArr=[];
                },
                onResetView:function(data){
                    resize.me();
                    var selectArr=bs.objArrDeepCopy(tools.modelSelectArr);
                    var arr=$("#modelTableWin").bootstrapTable('getData');
                    for(var i=0;i<selectArr.length;i++){
                        for(var j=0;j<arr.length;j++){
                            if(selectArr[i].id==arr[j].id){
                                $("#modelTableWin").bootstrapTable('check',j);
                            }
                        }
                    }
                },
                formatLoadingMessage: function () {
                    return '<div class="loaded">' +
                        '<div class="loader">' +
                        '<div class="loader-inner line-scale-pulse-out">' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '</div>' +
                        '</div>' +
                        '</div>' +
                        '<div>请稍等，数据正在加载中...</div>';
                },
                onExpandRow: function (index, row, $detail) {
                    //这一步就是相当于在当前点击列下新创建一个table
                    resize.me();
                    InitSubTable2(index, row, $detail);
                },
            });
        };
        //初始化子表格(无线循环)
        InitSubTable2 = function (index, row, $detail) {
            var parentid = row.id;
            var cur_table = $detail.html('<table></table>').find('table');
            $(cur_table).bootstrapTable({
//                url: '/api/MenuApi/GetChildrenMenu',
//                method: 'get',
                data: row.modelrulelist,
                queryParams: {strParentID: parentid},
                ajaxOptions: {strParentID: parentid},
                clickToSelect: true,
                uniqueId: "id",
                pageSize: 10,
                pageList: [10, 25],
                columns: [
                    {
                        field: 'ruletypename',
                        title: '规则类别'
                    }, {
                        field: 'rulename',
                        title: '规则名称'
                    }]
            });
        };
        return oTableInit2;
    };
    //    模型添加的表格
    var TableInit3 = function () {
        var oTableInit3 = new Object();
        var url = basePath + "/rest/handle/getTTSCapacity";
        //初始化Table
        oTableInit3.Init = function () {
            $('#modelTable').bootstrapTable("destroy")
            $('#modelTable').bootstrapTable({
//                toolbar: '#tools_bar',                //工具按钮用哪个容器
                data: tools.modelSelectArr,
//                url: url,         //请求后台的URL（*）
//                method: 'get',                      //请求方式（*）
                cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
                sortable: true,                     //是否启用排序
                sortOrder: "asc",                   //排序方式
//                responseHandler: function (res) {
//                    return {
//                        "total": res.result.length,//总页数
//                        "rows": res.result   //数据
//                    };
//                },
                pagination: true, // 是否显示分页（*）
                sidePagination: "client",           //分页方式：client客户端分页，server服务端分页（*）
                pageNumber: 1,                       //初始化加载第一页，默认第一页
                pageSize: 10,                       //每页的记录行数（*）
                pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
                search: false,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
                contentType: "application/x-www-form-urlencoded",
                strictSearch: true,
                showColumns: false,                  //是否显示所有的列
                showRefresh: false,                  //是否显示刷新按钮
                minimumCountColumns: 2,             //最少允许的列数
                clickToSelect: false,                //是否启用点击选中行
                uniqueId: "no",                     //每一行的唯一标识，一般为主键列
                showToggle: false,                    //是否显示详细视图和列表视图的切换按钮
                cardView: false,                    //是否显示详细视图
                detailView: true,
                cellStyle: {
                    css: {"background-color": "#fff"}
                },//是否显示父子表
                columns: [
                    {
                        title: '序号',//标题  可不加
                        field: 'id',
                        width: 60,
                        formatter:function(value,row,index){
                            return index+1;
                        }
                    },
                    {
                        field: 'name',
                        title: '模型名称'
                    },
                    {
                        field: 'note',
                        title: '备注',
                        formatter: function (value, row, index) {
                            if(value == null){
                                value=""
                            }
                            return "<div class='noteBoxTable' title='"+value+"'>"+value+"</div>";
                        }
                    }
                ],
                onLoadSuccess: function (data) {  //加载成功时执行
                    if (!data.rows||data.rows.length == 0) {
                        var src=basePath+"/assert/image/nodata.png";
                        $("#modelTable .no-records-found").find("td").html('<img src="'+src+'" th:src="@{/assert/image/nodata.png}" style="width:165px;" alt="">');
                    }
                },
                onLoadError: function () {  //加载失败时执行
//                    toastr.error('加载数据失败！');
                    $("#modelTable .no-records-found").find("td").html('<img src="../../../assert/image/nodata.png" th:src="@{/assert/image/nodata.png}" style="width:165px;" alt="">');
                },
                formatLoadingMessage: function () {
                    return '<div class="loaded">' +
                        '<div class="loader">' +
                        '<div class="loader-inner line-scale-pulse-out">' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '</div>' +
                        '</div>' +
                        '</div>' +
                        '<div>请稍等，数据正在加载中...</div>';
                },
                onExpandRow: function (index, row, $detail) {
                    //这一步就是相当于在当前点击列下新创建一个table
                    InitSubTable3(index, row, $detail);
                }
            });
        };
        //初始化子表格(无线循环)
        InitSubTable3 = function (index, row, $detail) {
            var parentid = row.id;
            var cur_table = $detail.html('<table></table>').find('table');
            $(cur_table).bootstrapTable({
//                url: '/api/MenuApi/GetChildrenMenu',
//                method: 'get',
                data: row.modelrulelist,
                queryParams: {strParentID: parentid},
                ajaxOptions: {strParentID: parentid},
                clickToSelect: true,
                uniqueId: "id",
                pageSize: 10,
                pageList: [10, 25],
                columns: [{
                    field: 'ruletypename',
                    title: '规则类别'
                }, {
                    field: 'rulename',
                    title: '规则名称'
                }]
            });
        };
        return oTableInit3;
    };
    //    模型编辑的表格
    var TableInit4 = function () {
        var oTableInit4 = new Object();
        var url = basePath + "/rest/handle/getTTSCapacity";
        //初始化Table
        oTableInit4.Init = function (elem) {
            elem.bootstrapTable("destroy");
            elem.bootstrapTable({
//                toolbar: '#tools_bar',                //工具按钮用哪个容器
                data: tools.modelSelectArr,
//                url: url,         //请求后台的URL（*）
//                method: 'get',                      //请求方式（*）
                cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
                sortable: true,                     //是否启用排序
                sortOrder: "asc",                   //排序方式
//                responseHandler: function (res) {
//                    return {
//                        "total": res.result.length,//总页数
//                        "rows": res.result   //数据
//                    };
//                },
                pagination: true, // 是否显示分页（*）
                sidePagination: "client",           //分页方式：client客户端分页，server服务端分页（*）
                pageNumber: 1,                       //初始化加载第一页，默认第一页
                pageSize: 10,                       //每页的记录行数（*）
                pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
                search: false,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
                contentType: "application/x-www-form-urlencoded",
                strictSearch: true,
                showColumns: false,                  //是否显示所有的列
                showRefresh: false,                  //是否显示刷新按钮
                minimumCountColumns: 2,             //最少允许的列数
                clickToSelect: false,                //是否启用点击选中行
                uniqueId: "no",                     //每一行的唯一标识，一般为主键列
                showToggle: false,                    //是否显示详细视图和列表视图的切换按钮
                cardView: false,                    //是否显示详细视图
                detailView: true,
                cellStyle: {
                    css: {"background-color": "#fff"}
                },//是否显示父子表
                columns: [
                    {
                        title: '序号',//标题  可不加
                        field: 'id',
                        width: 60,
                        formatter:function(value,row,index){
                            return index+1;
                        }
                    },
                    {
                        field: 'name',
                        title: '模型名称'
                    },
                    {
                        field: 'note',
                        title: '备注',
                        formatter: function (value, row, index) {
                            if(value == null){
                                value=""
                            }
                            return "<div class='noteBoxTable' title='"+value+"'>"+value+"</div>";
                        }
                    }
                ],
                onLoadSuccess: function (data) {  //加载成功时执行
                    if (!data.total||data.total == 0) {
                        elem.find(".no-records-found").find("td").html('<img src="../../../assert/image/nodata.png" th:src="@{/assert/image/nodata.png}" style="width:165px;" alt="">');
                    }
                },
                onLoadError: function () {  //加载失败时执行
//                    toastr.error('加载数据失败！');
                    elem.find(".no-records-found").find("td").html('<img src="../../../assert/image/nodata.png" th:src="@{/assert/image/nodata.png}" style="width:165px;" alt="">');
                },
                formatLoadingMessage: function () {
                    return '<div class="loaded">' +
                        '<div class="loader">' +
                        '<div class="loader-inner line-scale-pulse-out">' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '<div></div>' +
                        '</div>' +
                        '</div>' +
                        '</div>' +
                        '<div>请稍等，数据正在加载中...</div>';
                },
                onExpandRow: function (index, row, $detail) {
                    //这一步就是相当于在当前点击列下新创建一个table
                    InitSubTable4(index, row, $detail);
                }
            });
        };
        //初始化子表格(无线循环)
        InitSubTable4 = function (index, row, $detail) {
            var parentid = row.id;
            var cur_table = $detail.html('<table></table>').find('table');
            $(cur_table).bootstrapTable({
//                url: '/api/MenuApi/GetChildrenMenu',
//                method: 'get',
                data: row.modelrulelist,
                queryParams: {strParentID: parentid},
                ajaxOptions: {strParentID: parentid},
                clickToSelect: true,
                uniqueId: "id",
                pageSize: 10,
                pageList: [10, 25],
                columns: [{
                    field: 'ruletypename',
                    title: '规则类别'
                }, {
                    field: 'rulename',
                    title: '规则名称'
                }]
            });
        };
        return oTableInit4;
    };
    var resize = {
        init: function () {
            resize.me();
            $(window).resize(function () {
                resize.me();
            })
        },
        me: function () {
            var winW = $(window).width();
            var winH = $(window).height();
            $(".ibox").width(winW - 20);
            $(".ibox").height(winH - 20);
            bs.autoTableHeight($('#myTable'),winH -$(".tools_bar").height()-22-$(".search").height())
            $("#addModelModal .fixed-table-body").css("maxHeight","431px");
            $("#jstree").css("maxHeight","454px");
        }
    };
    var tools = {
        maxTextLength:null,
        seatIdArr:[],
        modelSelectArr: [],
        nowSelectArr: [],
        taskArr: [
            {
                "name": "全部",
                "value": ""
            }
        ],
        stateArr: [
            {
                name: "全部",
                value: ""
            }
        ],
        proArr: [],
        creatPersonArr: [
            {
                name: "全部",
                value: ""
            }
        ],
        seatGroupArr: [],
        onHookArr: [],//用来存储挂机方状态
        reCallFlagArr: [],//用来存储重复来电状态
        agreeArr: [],//用来存储满意度状态
        customerLevelArr:[],//用来存放用户星级
        customerlocArr:[],//用来存放归属地
        callDirectionArr: [],//用来存储呼叫类型状态
        imCustomerArr:[],//用来存储重要客户状态
        init: function () {
            tools.getConfig();
            tools.selectInit();//下拉框，日期插件初始化
            tools.tabSearch();//是否显示查询条
            tools.search();//查询
            tools.enterSearch();//查询
            tools.reset();//重置
            tools.refresh();//刷新
            tools.addModel();//添加任务
            tools.addModelWin();
            tools.editModel();
            tools.editCon();
            tools.delModel();
            tools.startModel();
            tools.stopModel();
            tools.renderLookCondition();
            tools.closeSelectModel();
            $("#addModal").on("hidden.bs.modal",function(){
                var form=$("#addForm");
                tools.hideLabel(form,'#workNameAdd');
                tools.hideLabel(form,'#proModalAddInput');
                tools.hideLabel(form,'#timeModalAddInput');
                tools.hideLabel(form,'#durMin');
                tools.hideLabel(form,'#durMax');
                tools.hideLabel(form,'#customerNumAdd');
                tools.hideLabel(form,'#seatIdModalAdd');
                tools.hideLabel(form,'#serialNumberAdd');
                $("#descriptionAdd").removeClass("jqx-validator-error-element");
                tools.hideLabel(form, '#descriptionAdd');
                tag.clearTag();
            });
            $("#editModal").on("hidden.bs.modal",function(){
                var form=$("#editForm");
                tools.hideLabel(form,'#workNameEdit');
                tools.hideLabel(form,'#proModalEditInput');
                tools.hideLabel(form,'#timeModalEditInput');
                tools.hideLabel(form,'#durMinEdit');
                tools.hideLabel(form,'#durMaxEdit');
                tools.hideLabel(form,'#customerNumEdit');
                tools.hideLabel(form,'#seatIdModalEdit');
                tools.hideLabel(form,'#serialNumberEdit');
                $("#descriptionEdit").removeClass("jqx-validator-error-element");
                tools.hideLabel(form, '#descriptionEdit');
                tag.clearTag();
            });
            $("#addModelModal").on("hidden.bs.modal",function(){
               $(this).find(".search_box input").val("")
            });
        },
        getConfig: function () {
            var maxNum= bs.getSysConfig("NAME_LIMIT");
            var num=50;
            if(maxNum){
                num=maxNum.value
            }
            tools.maxTextLength= num;
//            tools.ruleUrl = data.value;
        },
        hideLabel:function(form,input){
            form.jqxValidator('hideHint', input);
        },
        selectInit: function () {
            bs.dataTime("#start", "#end");//时间初始化
            bs.dataTime("#start1", "#end1");
            bs.dataTime("#start2", "#end2");
            bs.dataTime("#startTimeAdd", "#endTimeAdd");
            bs.dataTime("#startTimeEdit", "#endTimeEdit");
            tools.getState();//获取预质检状态
            tools.getHook();//获取挂机方状态
            tools.getSatStatus();//获取满意度状态
            tools.getReCallFlag();//获取重复来电状态
            tools.getCustomer();//获取客户星级状态
            tools.getCallDirection();//获取呼叫类型状态
            tools.getImCustomer();//获取重要客户状态
            tools.selectProvince();//获取省份
            tools.getTaskNameData($("#pro").val());//获取任务
            tools.getGreatPerson();//获取所有创建人
            tools.creatUserInit($("#createP"));//初始化所有创建人
            tools.selectChange($("#proModalAdd"),$("#proModalAddInput"));
            tools.selectChange($("#proModalEdit"),$("#proModalEditInput"));
            $("#pro").on("change", function (event, sel) {//根据省份渲染分类信息
                tools.getTaskNameData($("#pro").val());//获取任务
                $("#createP").val("");
                tools.getGreatPerson();//获取所有创建人
                tools.creatUserInit($("#createP"));//初始化所有创建人
            });
            $("#proModalAdd").on("change", function (event, sel) {//根据省份渲染分类信息
                var code=$("#proModalAdd").val();
                tools.getSeatGroup(bs.getXInY(tools.proArr, "id", "value", code));
                tools.seatGroupInit($("#seatGroupModalAdd"));
                tools.getSeatId(bs.getXInY(tools.proArr, "id", "value", code),  $("#seatGroupModalAdd").val());
                tools.seatIdInit($("#seatIdModalAdd"));
                tools.getProvicenCity(code);
                tools.proCityInit($("#proCityAdd"));
                $("#seatIdModalAdd").val("");
                $("#customerNumAdd").val("");
                $("#serialNumberAdd").val("");
                tools.modelSelectArr = [];
                $("#modelNum").html(tools.modelSelectArr.length);
                var oTable3 = new TableInit3();
                oTable3.Init();
                $(".tagName").val("").attr({"data-id": "","title":""});
                tag.modelSelectTagArr={
                    "0":[],
                    "1":[]
                };
            });
            $("#proModalEdit").on("change", function (event, sel) {//根据省份渲染分类信息
                var code=$("#proModalEdit").val();
                tools.getSeatGroup(bs.getXInY(tools.proArr, "id", "value", code));
                tools.seatGroupInit($("#seatGroupModalEdit"));
                tools.getSeatId(bs.getXInY(tools.proArr, "id", "value",code),  $("#seatGroupModalEdit").val());
                tools.seatIdInit($("#seatIdModalEdit"));
                tools.getProvicenCity(code);
                tools.proCityInit($("#proCityEdit"));
                $("#seatIdModalEdit").val("");
                $("#customerNumEdit").val("");
                $("#serialNumberEdit").val("");
                tools.modelSelectArr = [];
                $("#modelNumEdit").html(tools.modelSelectArr.length);
                var oTable4 = new TableInit4();
                oTable4.Init($("#modelTableEdit"));
                $(".tagName").val("").attr({"data-id": "","title":""});
                tag.modelSelectTagArr={
                    "0":[],
                    "1":[]
                };
            });
            $("#seatGroupModalAdd").on("change", function (event, sel) {
                var id=$(this).val();
                tools.getSeatId(bs.getXInY(tools.proArr, "id", "value", $("#proModalAdd").val()),id);
                tools.seatIdInit($("#seatIdModalAdd"));
                $("#seatIdModalAdd").val("");
            });
            $("#seatGroupModalEdit").on("change", function (event, sel) {
                var id=$(this).val();
                tools.getSeatId(bs.getXInY(tools.proArr, "id", "value", $("#proModalEdit").val()),id);
                tools.seatIdInit($("#seatIdModalEdit"));
                $("#seatIdModalEdit").val("");
            });
        },
        selectChange:function($elem,$input){
            $elem.on("change", function (event, sel) {
                $input.val($(this).val());
                if ($(this).val() == "") {
                    $input.next().html("").css("display", "none !important");
                }
            });
        },
        selectProvince: function () {
            tools.proArr = bs.getProvince();
            bs.selectBootStrap($("#proModalAdd"), tools.proArr,"100%");
            $("#proModalAddInput").val($("#proModalAdd").val());
            bs.selectBootStrap($("#proModalEdit"), tools.proArr,"100%");
            bs.selectBootStrap($("#pro"), tools.proArr);
        },
        getProvicenCity:function(provinceCode){
            $.ajax({
                type: "POST",
                url: basePath + 'rest/common/getProvinceCity',
                dataType: "json",
                contentType: 'application/json',
                data: JSON.stringify({"provinceCode":provinceCode}),
                async: false,
                success: function (data) {
                    var result = data.data;
                    var arr=[];
                    for(var key in result){
                        var obj={};
                        obj.name=result[key];
                        obj.value=key ;
                        arr.push(obj);
                    }
                    if(provinceCode==""){
                        tools.customerlocArr=[];
                    }else{
                        tools.customerlocArr=arr;
                    }
                }
            });
        },
        proCityInit:function(elem){
            bs.selectBootStrap(elem, tools.customerlocArr,"100%");
        },
        getSeatGroup:function(id){
            if(id){
                if ($("#userIdentity", parent.document).text() == "0") {
                    tools.seatGroupArr = bs.getMeSeatGroupData();
                } else {
                    tools.seatGroupArr = bs.getSeatGroupData(id);
                }
                tools.seatGroupArr.shift();
            }else{
                tools.seatGroupArr=[];
            }
        },
        seatGroupInit:function(elem){
            bs.selectBootStrap(elem, tools.seatGroupArr,"100%");
        },
        getGreatPerson:function(){
            // tools.seatAllArr=bs.getGreatPerson("/rest/searchUser/searchPreQualityUser","");
            tools.seatAllArr=bs.getAllUsers("");
        },
        creatUserInit:function(elem){
            var nameArr=[];
            for(var i=0;i<tools.seatAllArr.length;i++){
                nameArr.push(tools.seatAllArr[i].userName);
            }
            elem.autocomplete({
                source: nameArr
            });
        },
        getSeatId: function (areaId, seatGroupId) {
            if(areaId==""){
                tools.seatIdArr=[]
            }else{
                tools.seatIdArr=bs.getSeatData(areaId,seatGroupId,"");
            }
        },
        seatIdInit:function(elem){
            var nameArr=[];
            for(var i=0;i<tools.seatIdArr.length;i++){
                nameArr.push(tools.seatIdArr[i].account);
            }
            elem.autocomplete({
                source: nameArr
            });
        },
        getTaskNameData: function (code) {
            $.ajax({
                type: "post",
                url: basePath + "/rest/per-task/get-tasks-by-type",
                dataType: "json",
                async:false,
                data: {
                    workType: "1",
                    code:code
                },
                success: function (data) {
                    if (data.code == 0) {
                        var dataArr = data.data;
                        tools.taskArr = [{name: "全部", value: ""}];
                        for (var i = 0; i < dataArr.length; i++) {
                            var obj = {};
                            obj.name = dataArr[i].workname;
                            obj.value = dataArr[i].id;
                            tools.taskArr.push(obj);
                        }
                        bs.selectBootStrap($("#taskName"), tools.taskArr);
                    } else {
                        toastrCog.error(data.msg, 3000)
                    }
                }
            })
        },
        getState: function () {
            var dataArr = bs.getStatus("pre_work_status");
            Object.assign(tools.stateArr, dataArr);//es6复制数组的方法
            bs.selectBootStrap($("#proStatus"), tools.stateArr);
        },
        getCustomer: function () {
            tools.customerLevelArr= bs.getStatus("audio_customer_level");
            bs.selectBootStrap($("#customerLevelAdd"), tools.customerLevelArr, "100%");
            bs.selectBootStrap($("#customerLevelEdit"), tools.customerLevelArr, "100%");
        },
        getCallDirection:function(){
            var dataArr = bs.getStatus("call_direction");
            Object.assign(tools.callDirectionArr,dataArr);//es6复制数组的方法
            bs.selectBootStrap($("#callDirectionAdd"), tools.callDirectionArr, "100%");
            bs.selectBootStrap($("#callDirectionEdit"), tools.callDirectionArr,"100%");
        },
        getImCustomer: function () {
            tools.imCustomerArr= bs.getStatus("is_important_customers");
            bs.selectBootStrap($("#customerSignAdd"), tools.imCustomerArr,"100%");
            bs.selectBootStrap($("#customerSignEdit"), tools.imCustomerArr,"100%");
        },
        getHook: function () {
            var dataArr = bs.getStatus("audio_onhook");
            Object.assign(tools.onHookArr,dataArr);//es6复制数组的方法
            bs.selectBootStrap($("#onHookAdd"), tools.onHookArr,"100%");
            bs.selectBootStrap($("#onHookEdit"), tools.onHookArr,"100%");
        },
        getSatStatus: function () {
            var dataArr = bs.getStatus("audio_satisfaction");
            Object.assign(tools.agreeArr,dataArr);//es6复制数组的方法
            bs.selectBootStrap($("#satisfactionAdd"), tools.agreeArr,"100%");
            bs.selectBootStrap($("#satisfactionEdit"), tools.agreeArr,"100%");
        },
        getReCallFlag:function(){
            var dataArr = bs.getStatus("recall_flag");
            Object.assign(tools.reCallFlagArr,dataArr);//es6复制数组的方法
            bs.selectBootStrap($("#reCallFlagAdd"), tools.reCallFlagArr,"100%");
            bs.selectBootStrap($("#reCallFlagEdit"), tools.reCallFlagArr,"100%");
        },
        tipShow: function () {
            $(".tipInput").hover(function () {
                $(this).find(".tip").removeClass("hidden")
            }, function () {
                $(this).find(".tip").addClass("hidden")
            })
        },
        tabSearch: function () {
            var search = $(".search");
            $("#btnSearch").on("click", function () {
                if (search.hasClass("on")) {
                    search.slideUp();
                    search.removeClass("on");
                    $("#btnSearch").html('<i class="fa fa-filter"></i> 查询').attr("title", "显示查询条");
                } else {
                    search.slideDown();
                    search.addClass("on");
                    $("#btnSearch").html('<i class="fa fa-filter"></i> 隐藏').attr("title", "隐藏查询条");
                }

            });
        },
        search: function () {
            $("#search").on("click", function () {
                tools.tableRefresh();
            })
        },
        enterSearch: function () {
            $("body").on("keyup", function (e) {
                var code = e.charCode || e.keyCode;
                if (code == 13) {
                    //此处编写用户敲回车后的代码
                    tools.tableRefresh();
                }
            })
        },
        tableRefresh: function () {
            $("#myTable").bootstrapTable('refreshOptions', {pageNumber:1});
            $("#myTable").bootstrapTable('refresh');
        },
        reset: function () {
            $("#reset").on("click", function () {
                bs.resetSearch($(".search"));
                if($("#laydate_box").length>0){
                    bs.resetTimeElems("#start","#end","#start1","#end1","#start2","#end2");
                }
                tools.getTaskNameData($("#pro").val());//获取任务
                tools.getSeatId(bs.getXInY(tools.proArr, "id", "value", $("#pro").val()),"");
                tools.seatIdInit($("#createP"));
                tools.tableRefresh();
            });
            // $("#resetModel").on("click",function(){
            //     $("#classify").val("");
            //     $("#proSelectModal").val("");
            //     $("#jstree").jstree("deselect_all", true);
            //     $("#modelTableWin").bootstrapTable('refresh');
            // })
        },
        resetSelect: function ($obj) {
            if(!$obj.prop("disabled")){
                $obj.selectpicker("val","");
            }
        },
        refresh: function () {
            $("#refresh").on("click", function () {
                $("#myTable").bootstrapTable('refresh');
            })
        },
        addModel: function () {
            $("#addModal").on("show.bs.modal", function () {
                tools.addFormreset();
            });
            $("#btnAdd").on("click", function () {
                $("#addModal").modal("show");
            });
            $("#addSave").on("click", function () {
                $("#addForm").jqxValidator("validate");
            });
            $("#addForm").on("validationSuccess", function (event) {
                var scoreFlagVal=$("input[name='scoreFlag']:checked").val();
                if(scoreFlagVal === undefined){
                    toastrCog.error("请选择计分方式！");
                    return
                }
                var selectModelArr = tools.modelSelectArr;
                var modelIds = "";
                for (var i = 0; i < selectModelArr.length; i++) {
                    modelIds += selectModelArr[i].id + ",";
                }
                modelIds = modelIds.substr(0, modelIds.length - 1);
                if(selectModelArr.length<=0){
                    toastrCog.error("请选择质检模型！");
                    return
                }
                var seatGroupAddList = $("#seatGroupModalAdd").val();
                seatGroupAddList=!seatGroupAddList ? []:seatGroupAddList;
                var satisfactionAddList = $("#satisfactionAdd").val();
                satisfactionAddList=!satisfactionAddList ? []:satisfactionAddList;
                var onHookAddList = $("#onHookAdd").val();
                onHookAddList=!onHookAddList ? []:onHookAddList;
                var customerLevelAddList = $("#customerLevelAdd").val();
                customerLevelAddList=!customerLevelAddList ? []:customerLevelAddList;
                var customerlocAddList = $("#proCityAdd").val();
                customerlocAddList=!customerlocAddList ? []:customerlocAddList;
                if(seatGroupAddList.length>200){
                    toastrCog.error("选择的坐席班组太多了！",3000);
                    return;
                }
                $.ajax({
                    type: "post",
                    url: basePath + "/rest/per-task/add-data",
                    dataType: "json",
                    data: {
                        provinceCode: $("#proModalAdd").val(),
                        workType: "1",
                        workName: $.trim($("#workNameAdd").val()),
                        callStartTime: $("#startTimeAdd").val(),
                        callEndTime: $("#endTimeAdd").val(),
                        seatGroupId: seatGroupAddList.join(","),
                        seatIds: $.trim($("#seatIdModalAdd").val()),
                        customerNum: $.trim($("#customerNumAdd").val()),
                        onHook: onHookAddList.join(","),
                        satisfaction:satisfactionAddList.join(","),
                        customerLevels: customerLevelAddList.join(","),
                        customerloc: customerlocAddList.join(","),
                        reCallFlag: $("#reCallFlagAdd").val(),
                        serialNumber: $.trim($("#serialNumberAdd").val()),
                        description: $.trim($("#descriptionAdd").val()),
                        minDuration: $.trim($("#durMin").val()),
                        maxDuration: $.trim($("#durMax").val()),
                        modelIds: modelIds,
                        scoreFlag:$("input[name='scoreFlag']:checked").val(),
                        customerSign:$("#customerSignAdd").val(),
                        callDirection:$("#callDirectionAdd").val(),
                        callTags:$("#tagTrafficAdd0").val(),
                        sysTags:$("#tagTrafficAdd1").val()
                    },
                    success: function (data) {
                        if (data.code == 0) {
                            tools.getTaskNameData($("#pro").val());//获取任务
                            $("#myTable").bootstrapTable('refresh');
                            toastrCog.success(data.msg, 1000)
                        } else {
                            toastrCog.error(data.msg, 3000)
                        }
                        $("#addModal").modal("hide");
                    }
                })
            })
        },
        addFormreset:function(){
            // 重置表单
            $('#addForm').find('input,textarea').not('.proModalAdd,input[name="scoreFlag"]').val('');
            $('input[name="scoreFlag"]').prop("checked",false);
            tools.resetSelect($("#onHookAdd"));
            tools.resetSelect($("#satisfactionAdd"));
            tools.resetSelect($("#reCallFlagAdd"));
            tools.resetSelect($("#customerLevelAdd"));
            tools.resetSelect($("#callDirectionAdd"));
            tools.resetSelect($("#customerSignAdd"));
            // 重置时间
            if($("#laydate_box").length>0){
                bs.resetTimeElems("#startTimeAdd","#endTimeAdd");
            }
            // 重置省份 班组 工号 归属地
            // tools.selectProvince();
            if(tools.proArr.length!=2){
                $("#proModalAdd").selectpicker('val','');
            }
            $("#proModalAddInput").val($("#proModalAdd").val());
            var proCode=$("#proModalAdd").val();
            tools.getSeatGroup(bs.getXInY(tools.proArr, "id", "value", proCode));
            tools.getSeatId(bs.getXInY(tools.proArr, "id", "value", proCode),  $("#seatGroupModalAdd").val());
            tools.getProvicenCity(proCode);
            tools.seatGroupInit($("#seatGroupModalAdd"));
            tools.seatIdInit($("#seatIdModalAdd"));
            tools.proCityInit($("#proCityAdd"));
            // 重置已选模型
            tools.modelSelectArr = [];
            $("#modelTable").bootstrapTable('destroy');
            var oTable3 = new TableInit3();
            oTable3.Init();
            $("#modelNum").html(tools.modelSelectArr.length);
            $(".tagName").val("").attr({"data-id": "","title":""});
            tag.modelSelectTagArr={
                "0":[],
                "1":[]
            };
        },
        addModelWin: function () {
            $("#addModelWinBtn,#editModelWinBtn").unbind("click").on("click", function () {
                var proModalAddVal=$("#proModalAdd").val();
                if($(this).attr("id")=="addModelWinBtn"){
                    if(proModalAddVal==""){
                        toastrCog.error("请先选择省份！");
                        return
                    }
                    menu.init(proModalAddVal);
                    $("#proSelectModal").val(proModalAddVal);
                }
                var proModalEditVal=$("#proModalEdit").val();
                if($(this).attr("id")=="editModelWinBtn"){
                    if(proModalEditVal==""){
                        toastrCog.error("请先选择省份！");
                        return
                    }
                    menu.init(proModalEditVal);
                    $("#proSelectModal").val(proModalEditVal);
                }
                tools.nowSelectArr = bs.objArrDeepCopy(tools.modelSelectArr)
                var oTable2 = new TableInit2();
                oTable2.Init();
                $("#addModelModal").modal("show");
            });
            $("#addModelModal").on("show.bs.modal", function () {
                $("#searchMenu").prev().val("");
                $("#searchMenu").click();
                $("#classify").val("");
                $("#jstree").jstree("deselect_all", true);
                var oTable2 = new TableInit2();
                oTable2.Init();
            });
            $("#selectModel").on("click", function () {
                // var selections = $('#modelTableWin').bootstrapTable("getSelections");
                // tools.modelSelectArr = selections;
                $("#modelNum").html(tools.modelSelectArr.length);
                $("#modelNumEdit").html(tools.modelSelectArr.length);
                $("#modelTable").bootstrapTable('destroy');
                var oTable3 = new TableInit3();
                oTable3.Init();
                var oTable4 = new TableInit4();
                oTable4.Init($("#modelTableEdit"));
                $("#addModelModal").modal("hide");
            })
        },
        editModel: function () {
            $("#editModal").on("hide.bs.modal", function () {
                tools.modelSelectArr = [];
            });
            $("#btnEdit").on("click", function () {
                var selectArr = $("#myTable").bootstrapTable("getSelections");
                if (selectArr.length <= 0) {
                    toastrCog.error("请选择要编辑的数据！", 3000);
                } else if (selectArr.length > 1) {
                    toastrCog.error("请选择一条要编辑的数据！", 3000);
                } else {
                    var proStatus=selectArr[0].proStatus;
                    if (proStatus == 4) {//是否已停止
                        toastrCog.error("所选任务已停止，为了保存数据统一，不能编辑！", 3000);
                    }else if (proStatus == 3) {//是否已完成
                        toastrCog.error("所选任务已完成，不能编辑！", 3000);
                    }else if ((proStatus == 1)||(proStatus == 2)) {//是否质检中
                       $("#editConModal").modal("show");
                    }else{
                       tools.renderEditModel(selectArr);
                        $("#editForm input").prop("disabled",false);
                        $("#editForm .modal-body button").prop("disabled",false);
                        $("#editForm textarea").prop("disabled",false);
                        $("#seatGroupModalEdit").prop("disabled",false).trigger("chosen:updated");
                    }
                }
            });
            $("#editSave").on("click", function () {
                $("#editForm").jqxValidator("validate");
            });
            $("#editForm").on("validationSuccess", function (event) {
                var id = $("#editModal").attr("data-id");
                var selectModelArr = tools.modelSelectArr;
                var modelIds = "";
                for (var i = 0; i < selectModelArr.length; i++) {
                    modelIds += selectModelArr[i].id + ",";
                }
                modelIds = modelIds.substr(0, modelIds.length - 1);
                if(selectModelArr.length<=0){
                    toastrCog.error("请选择质检模型！");
                    return
                }
                var seatGroupEditList = $("#seatGroupModalEdit").val();
                seatGroupEditList=!seatGroupEditList ? []:seatGroupEditList;
                var satisfactionEditList = $("#satisfactionEdit").val();
                satisfactionEditList=!satisfactionEditList ? []:satisfactionEditList;
                var onHookEditList = $("#onHookEdit").val();
                onHookEditList=!onHookEditList ? []:onHookEditList;
                var customerLevelEditList = $("#customerLevelEdit").val();
                customerLevelEditList=!customerLevelEditList ? []:customerLevelEditList;
                var customerlocEditList = $("#proCityEdit").val();
                customerlocEditList=!customerlocEditList ? []:customerlocEditList;
                if(seatGroupEditList.length>200){
                    toastrCog.error("选择的坐席班组太多了！",3000);
                    return;
                }
                $.ajax({
                    type: "post",
                    url: basePath + "/rest/per-task/update-data",
                    dataType: "json",
                    data: {
                        id: id,
                        provinceCode: $("#proModalEdit").val(),
                        workType: "1",
                        workName: $.trim($("#workNameEdit").val()),
                        callStartTime: $("#startTimeEdit").val(),
                        callEndTime: $("#endTimeEdit").val(),
                        seatGroupId: seatGroupEditList.join(","),
                        seatIds: $.trim($("#seatIdModalEdit").val()),
                        customerNum: $.trim($("#customerNumEdit").val()),
                        onHook: onHookEditList.join(","),
                        satisfaction:satisfactionEditList.join(","),
                        customerLevels: customerLevelEditList.join(","),
                        customerloc: customerlocEditList.join(","),
                        reCallFlag: $("#reCallFlagEdit").val(),
                        serialNumber: $.trim($("#serialNumberEdit").val()),
                        description: $.trim($("#descriptionEdit").val()),
                        minDuration: $.trim($("#durMinEdit").val()),
                        maxDuration: $.trim($("#durMaxEdit").val()),
                        modelIds: modelIds,
                        scoreFlag:$("input[name='scoreFlagEdit']:checked").val(),
                        customerSign:$("#customerSignEdit").val(),
                        callDirection:$("#callDirectionEdit").val(),
                        callTags:$("#tagTrafficEdit0").val(),
                        sysTags:$("#tagTrafficEdit1").val()
                    },
                    success: function (data) {
                        if (data.code == 0) {
                            tools.getTaskNameData($("#pro").val());//获取任务
                            toastrCog.success(data.msg, 1000)
                        } else {
                            toastrCog.error(data.msg, 3000)
                        }
                        $("#myTable").bootstrapTable('refresh');
                        $("#editModal").modal("hide");
                    }
                })
            })
        },
        editCon:function(){
            $("#editConBtn").on("click",function(){
                $("#editConModal").modal("hide");
                var selectArr = $("#myTable").bootstrapTable("getSelections");
                tools.renderEditModel(selectArr);
                $("#editForm input").prop("disabled",true);
                $("#editForm .modal-body button").prop("disabled",true);
                $("#editForm textarea").prop("disabled",true);
                $("#seatGroupModalEdit").prop("disabled",true).trigger("chosen:updated");
                $("#workNameEdit").prop("disabled",false);
            })
        },
        renderEditModel:function(selectArr){
            $("#editModal").modal("show");
            $("#editForm")[0].reset();
            selectArr[0].callStartTime1 = dateFormatUtil(selectArr[0].callStartTime);
            selectArr[0].callEndTime1 = dateFormatUtil(selectArr[0].callEndTime);
            var seatGroupIdsArr=[],satisfactionArr=[],onHooksArr=[],customerLevelArr=[],customerlocArr=[];
            if(selectArr[0].seatGroupIds){
                seatGroupIdsArr=selectArr[0].seatGroupIds.split(",");
            }
            if(selectArr[0].satisfaction){
                satisfactionArr=selectArr[0].satisfaction.split(",");
            }
            if(selectArr[0].onHooks){
                onHooksArr=selectArr[0].onHooks.split(",");
            }
            if (selectArr[0].customerLevels) {
                customerLevelArr = selectArr[0].customerLevels.split(",");
            }
            if (selectArr[0].customerloc) {
                customerlocArr = selectArr[0].customerloc.split(",");
            }
            // 省份
            $("#proModalEdit").selectpicker('val',selectArr[0].provinceCode)
            var proVal=$("#proModalEdit").val();
            $("#proModalEditInput").val(proVal);
            bs.loadFormData($("#editForm"), selectArr[0]);
            // 坐席班组
            tools.getSeatGroup(bs.getXInY(tools.proArr, "id", "value", proVal));
            tools.seatGroupInit($("#seatGroupModalEdit"));
            $("#seatGroupModalEdit").selectpicker('val',seatGroupIdsArr)
            // 坐席工号
            tools.getSeatId(bs.getXInY(tools.proArr, "id", "value", proVal),$("#seatGroupModalEdit").val());
            tools.seatIdInit($("#seatIdModalEdit"));
            $("#seatIdModalEdit").val(selectArr[0].seatIds)
            // 归属地
            tools.getProvicenCity($("#proModalEdit").val());
            tools.proCityInit($("#proCityEdit"));
            $("#proCityEdit").selectpicker('val',customerlocArr)
            $("#satisfactionEdit").selectpicker('val',satisfactionArr)
            $("#onHookEdit").selectpicker('val',onHooksArr)
            $("#customerLevelEdit").selectpicker('val',customerLevelArr)
            $("#reCallFlagEdit").selectpicker('val',selectArr[0].reCallFlag)
            $("#callDirectionEdit").selectpicker('val',selectArr[0].callDirection)
            $("#customerSignEdit").selectpicker('val',selectArr[0].customerSign)
            $("input[name='scoreFlagEdit'][value='"+selectArr[0].scoreFlag+"']").prop("checked",true);
            bs.allTimeElem["#endTimeEdit"].min = selectArr[0].callStartTime1;
            bs.allTimeElem["#endTimeEdit"].start =  selectArr[0].callStartTime1;
            bs.allTimeElem["#startTimeEdit"].max =  selectArr[0].callEndTime1
            tools.modelSelectArr = [];
            $.ajax({
                type: "post",
                url: basePath + "/rest/per-task/get-modelId-by-taskId",
                dataType: "json",
                async:false,
                data: {
                    id: selectArr[0].id
                },
                success: function (data) {
                    var dataArr = data.data;
                    if (data.code == 0) {
                        for (var i = 0; i < dataArr.length; i++) {
                            var model = dataArr[i].model;
                            tools.modelSelectArr.push(model);
                        }
                        $("#modelNumEdit").html(tools.modelSelectArr.length);
                        var oTable4 = new TableInit4();
                        oTable4.Init($("#modelTableEdit"));
                    }
                }
            });
            $("#editModal").attr("data-id", selectArr[0].id);
        },
        startModel: function () {
            $("#btnStart").on("click", function () {
                var selectArr = $("#myTable").bootstrapTable("getSelections");
                var num0=tools.getTaskStateArr(selectArr).num0;
                var arr=tools.getTaskStateArr(selectArr).arr;//用来存放状态的任务数据
                var modelArr=tools.getTaskStateArr(selectArr).arr1;//用来存放有没有模型的任务的数据
                var modelStatusArr=tools.getTaskStateArr(selectArr).arr2;//用来存放有没有未上线模型的任务的数据
                if (selectArr.length <= 0) {//如果没有选择任务数据
                    toastrCog.error("请选择要启动的数据！", 3000);
                } else if (num0!=selectArr.length){//如果有未启动任务数据
                    var arr1=arr[1].value;
                    var arr3=arr[2].value;
                    var arr4=arr[3].value;
                    var str0=tools.getStr(arr1,"workName");
                    var str3=tools.getStr(arr3,"workName");
                    var str4=tools.getStr(arr4,"workName");
                    var str="";
                    if(arr1.length>0){
                        str+= "任务 "+str0+" 质检中,"
                    }
                    if(arr4.length>0){
                        str+= "任务 "+str4+" 已停止,"
                    }
                    if(arr3.length>0){
                        str+= "任务 "+str3+" 质检完成,"
                    }
                    str+="不能启动，请重新选择！";
                    toastrCog.error(str, 3000);
                }else if(modelArr[0].value.length>0) {//如果有没有模型的任务数据
                    toastrCog.error("任务 "+tools.getStr(modelArr[0].value,"workName")+" 没有选择模型，不能启动。若需要启动，请先选择模型！", 3000);
                }else if(modelStatusArr[0].value.length>0) {//如果有未上线模型的任务数据
                    var mArr=modelStatusArr[0].value;
                    var str="";
                    for(var i=0;i<mArr.length;i++){
                        var name=mArr[i].workName;
                        var id=mArr[i].id;
                        var nArr=[];
                        var models=mArr[i].models;
                        for(var j=0;j<models.length;j++){
                           if(models[j].modelProStStuts=="0"){
                               var isHas=false;
                               for(var m=0;m<nArr.length;m++){
                                   if(nArr[m].modelId==models[j].modelId){
                                       isHas=true;
                                   }
                               }
                               if(!isHas){
                                   nArr.push(models[j]);
                               }
                           }
                        }
                        var modelNames=tools.getStr(nArr,"modelName");
                        str+="任务 "+name+" 使用的模型 "+modelNames+" 未上线,";
                    }
                    str+="不能上线。若需要上线，请先上线所选模型或者重新编辑所选模型！";
                    toastrCog.error(str, 3000);
                }else {
                    $("#startModal").modal("show");
                    $("#startModal .modal-title").html("启动");
                    $("#type").html(
                        "确定要启动所选的"+
                        "<span style='color:rgb(50, 136, 226)'>"+arr[0].value.length+"</span>"+
                        "个任务"+
                        "<span style='color:rgb(50, 136, 226)'>"+tools.getStr(arr[0].value,"workName")+"</span>吗？");
                    $("#startModal").attr("data-id",  tools.getStr(arr[0].value,"id"));
                    $("#startModal").attr("data-code", 1);
                }
            });
            $("#startBtn").on("click", function () {
                $("#startBtn").html("请求中...请稍后").prop("disabled",true);
                var id = $("#startModal").attr("data-id");
                var code = $("#startModal").attr("data-code");
                $.ajax({
                    type: "post",
                    url: basePath + "/rest/per-task/start-or-stop-task",
                    dataType: "json",
                    data: {
                        id: id,
                        startOrStop: code
                    },
                    success: function (data) {
                        if (data.code == 0) {
                            $("#myTable").bootstrapTable('refresh');
                            toastrCog.success(data.msg, 1000)
                        } else if (data.code == -1) {
                            toastrCog.error(data.msg, 3000)
                        } else {
                            toastrCog.warning(data.msg, 3000)
                        }
                        $("#startBtn").html("确定").prop("disabled",false);
                        $("#startModal").modal("hide");
                    }
                })
            });
        },
        stopModel: function () {
            $("#btnStop").on("click", function () {
                var selectArr = $("#myTable").bootstrapTable("getSelections");
                var num1=tools.getTaskStateArr(selectArr).num1;
                var arr=tools.getTaskStateArr(selectArr).arr;//用来存放不是质检中的数据
                if (selectArr.length <= 0) {
                    toastrCog.error("请选择要停止的数据！", 3000);
                } else if (num1!=selectArr.length) {//不全是质检中的数据
                    var arr0=arr[0].value;
                    var arr3=arr[2].value;
                    var arr4=arr[3].value;
                    var str0=tools.getStr(arr0,"workName");
                    var str3=tools.getStr(arr3,"workName");
                    var str4=tools.getStr(arr4,"workName");
                    var str="";
                    if(arr0.length>0){
                        str+= "任务 "+str0+" 未启动,"
                    }
                    if(arr4.length>0){
                        str+= "任务 "+str4+" 已停止,"
                    }
                    if(arr3.length>0){
                        str+= "任务 "+str3+" 质检完成,"
                    }
                    str+="不能停止，请重新选择！";
                    toastrCog.error(str, 3000);
                } else {//全是质检中的数据
                    $("#startModal").modal("show");
                    $("#startModal .modal-title").html("停止");
                    $("#type").html(
                        "任务停止后，无法重新启动。确定要继续停止所选的"+
                        "<span style='color:rgb(50, 136, 226)'>"+arr[1].value.length+"</span>"+
                        "个任务"+
                        "<span style='color:rgb(50, 136, 226)'>"+tools.getStr(arr[1].value,"workName")+"</span>吗？");
                    $("#startModal").attr("data-id", tools.getStr(arr[1].value,"id"));
                    $("#startModal").attr("data-code", 4);
                }
            });
        },
        delModel: function () {
            $("#btnDel").on("click", function () {
                var selectArr = $("#myTable").bootstrapTable("getSelections");
                var num0=tools.getTaskStateArr(selectArr).num0;
                var arr=tools.getTaskStateArr(selectArr).arr;//用来存放不是未启动的数据
                if (selectArr.length <= 0) {
                    toastrCog.error("请选择要删除的数据！", 3000);
                } else if (num0!=selectArr.length){
                    var arr1=arr[1].value;
                    var arr3=arr[2].value;
                    var arr4=arr[3].value;
                    var str0=tools.getStr(arr1,"workName");
                    var str3=tools.getStr(arr3,"workName");
                    var str4=tools.getStr(arr4,"workName");
                    var str="";
                    if(arr1.length>0){
                        str+= "任务 "+str0+" 质检中,"
                    }
                    if(arr4.length>0){
                        str+= "任务 "+str4+" 已停止,"
                    }
                    if(arr3.length>0){
                        str+= "任务 "+str3+" 质检完成,"
                    }
                    str+="不能删除，请重新选择！";
                    toastrCog.error(str, 3000);
                }else{
                    $("#delModal").modal("show");
                    $("#delName").html(
                        "确定要删除所选的"+
                        "<span style='color:rgb(50, 136, 226)'>"+arr[0].value.length+"</span>"+
                        "个任务"+
                        "<span style='color:rgb(50, 136, 226)'>"+tools.getStr(arr[0].value,"workName")+"</span>吗？");
                    $("#delModal").attr("data-id", tools.getStr(arr[0].value,"id"));
                }

            });
            $("#delBtn").on("click", function () {
                var id = $("#delModal").attr("data-id");
                $.ajax({
                    type: "post",
                    url: basePath + "/rest/per-task/del-data-by-id",
                    dataType: "json",
                    data: {
                        ids: id
                    },
                    success: function (data) {
                        if (data.code == 0) {
                            tools.getTaskNameData($("#pro").val());//获取任务
                            tools.tableRefresh();
                            toastrCog.success(data.msg, 1000)
                        } else {
                            toastrCog.error(data.msg, 3000)
                        }
                        $("#delModal").modal("hide");
                    }
                })
            });
        },
        getTaskStateArr:function(selectArr){
            var num0=0;
            var num1=0;
            var arr=[
                {code:"0", value:[]},//未启动
                {code:"1", value:[]},//质检中
                {code:"3", value:[]},//质检完成
                {code:"4", value:[]}//已停止
            ];//用来存放任务的数据
            var arr1=[
                {code:"0", value:[]},//无模型
                {code:"1", value:[]}//有模型
            ];//用来存放任务的数据
            var arr2=[
                {code:"0", value:[]},//未上线
                {code:"1", value:[]}//已上线
            ];//用来存放任务的数据
            for (var i = 0; i < selectArr.length; i++) {
                var proStatus=selectArr[i].proStatus;
                var models=selectArr[i].models;
                if(proStatus=="0"){//未启动
                    num0++;
                    arr[0].value.push(selectArr[i]);
                }else if((proStatus=="1")||(proStatus=="2")){//质检中
                    num1++;
                    arr[1].value.push(selectArr[i]);
                }else if(proStatus=="3"){//质检完成
                    arr[2].value.push(selectArr[i]);
                }else if(proStatus=="4"){//已停止
                    arr[3].value.push(selectArr[i]);
                }
                if(models && models.length>0){
                    arr1[1].value.push(selectArr[i]);
                    for(var j=0;j<models.length;j++){
                        var modelProStatus=models[j].modelProStStuts;
                        if(modelProStatus=="0"){
                            arr2[0].value.push(selectArr[i]);
                            break;
                        }
                    }
                }else{
                    arr1[0].value.push(selectArr[i]);
                }
            }
            return {
                "num0":num0,
                "num1":num1,
                "arr":arr,
                "arr1":arr1,
                "arr2":arr2
            }
        },
        updataSelect: function ($obj, val) {
            $obj.val(val);
            $obj.trigger("chosen:updated");
        },
        getNameInCode:function(code){
            var name="";
            for(var i=0;i<tools.proArr.length;i++){
                if(tools.proArr[i].code==code){
                    name=tools.proArr[i].name;
                    break;
                }
            }
            return name;
        },
        getCodeInId:function(id){//根据省份id获取code
            var code="";
            for(var i=0;i<tools.proArr.length;i++){
                if(tools.proArr[i].id==id){
                    code=tools.proArr[i].code;
                    break;
                }
            }
            return code;
        },
        getIdInCode:function(code){//根据省份id获取code
            var id="";
            for(var i=0;i<tools.proArr.length;i++){
                if(tools.proArr[i].code==code){
                    id=tools.proArr[i].id;
                    break;
                }
            }
            return id;
        },
        getIdInName: function (account) {//根据工号名称获取id
            var id = "";
            for (var i = 0; i < tools.seatIdArr.length; i++) {
                if (tools.seatIdArr[i].account == account) {
                    id = tools.seatIdArr[i].id;
                    break;
                }
            }
            return id;
        },
        getNameInId: function (id) {//根据id称获取name
            var name = "";
            for (var i = 0; i < tools.seatIdArr.length; i++) {
                if (tools.seatIdArr[i].id == id) {
                    name = tools.seatIdArr[i].account;
                    break;
                }
            }
            return name;
        },
        getStr:function(selectArr,code){
            var str="";
            for (var i = 0; i < selectArr.length; i++) {
                str += selectArr[i][code] + ",";
            }
            str = str.substr(0, str.length - 1);
            return str;
        },
        isNull:function(value){
            if(value==null){
                value=""
            }
            return value;
        },
        renderLookCondition:function(){
            $("body").on("click",".fileNameLook",function(e){
                var row=JSON.parse($(this).attr("data-row"));
                tools.getSeatGroup(bs.getXInY(tools.proArr, "id", "value", row.provinceCode));
                tools.getProvicenCity(row.provinceCode);
                var workName=tools.isNull("("+row.workName+")");//任务名称
                var minDuration=tools.isNull(row.minDuration);
                var maxDuration=tools.isNull(row.maxDuration);
                var serialNumber=tools.isNull(row.serialNumbers);
                var scoreFlag=tools.isNull(row.scoreFlag);
                var seatGroup=tools.rootMultipleArr(tools.seatGroupArr,row.seatGroupIds,1);
                var satisfaction=tools.rootMultipleArr(tools.agreeArr,row.satisfaction,0);
                var onHook=tools.rootMultipleArr(tools.onHookArr,row.onHooks,0);
                var customerLevel=tools.rootMultipleArr(tools.customerLevelArr,row.customerLevels,0);
                var customerloc=tools.rootMultipleArr(tools.customerlocArr,row.customerloc,0);
                var seatId=tools.isNull(row.seatIds);
                var customerNum=tools.isNull(row.customerNums);
                var description=tools.isNull(row.description);
                var callTags=tools.isNull(row.callTags);
                var sysTags=tools.isNull(row.sysTags);
                var callStartTime = dateFormatUtil(row.callStartTime);
                var callEndTime = dateFormatUtil(row.callEndTime);
                $("#lookModal").modal("show");
                $("#lookForm")[0].reset();
                $("#lookId").html(workName);
                $("#lookPro").val(bs.getXInY(tools.proArr,"name","value",row.provinceCode));
                $("#lookTime").val(callStartTime+"-"+callEndTime);
                $("#lookPhoneTime").val(minDuration+"-"+maxDuration);
                $("#lookSeatGroup").val(seatGroup.join(",")).attr("title",seatGroup.join(","));
                $("#lookSeatId").val(seatId).attr("title",seatId);
                $("#lookPhone").val(customerNum).attr("title",customerNum);
                $("#lookSerialNumber").val(serialNumber).attr("title",serialNumber);
                $("#lookAgree").val(satisfaction.join(",")).attr("title",satisfaction.join(","));
                $("#lookRepeate").val(bs.changeState(row.reCallFlag,tools.reCallFlagArr));
                $("#lookHook").val(onHook.join(",")).attr("title",onHook.join(","));
                $("#lookCustomerLevel").val(customerLevel.join(",")).attr("title",customerLevel.join(","));
                $("#lookProCity").val(customerloc.join(",")).attr("title",customerloc.join(","));
                $("#lookRemark").val(description).attr("title",description);
                $("#lookCallDirection").val(bs.changeState(row.callDirection,tools.callDirectionArr));
                $("#lookCustomerSign").val(bs.changeState(row.customerSign,tools.imCustomerArr));
                $("#lookCallTags").val(callTags).attr("title",callTags);
                $("#lookSysTags").val(sysTags).attr("title",sysTags);
                if(scoreFlag==0){
                    scoreFlag="录音";
                }else{
                    scoreFlag="任务";
                }
                $("#lookSorce").val(scoreFlag);
                tools.modelSelectArr=[];
                $.ajax({
                    type: "post",
                    url: basePath + "/rest/per-task/get-modelId-by-taskId",
                    dataType: "json",
                    async:false,
                    data: {
                        id: row.id
                    },
                    success: function (data) {
                        var dataArr = data.data;
                        if (data.code == 0) {
                            for (var i = 0; i < dataArr.length; i++) {
                                var model = dataArr[i].model;
                                if(model){
                                    tools.modelSelectArr.push(model);
                                }
                            }
                            var oTable4 = new TableInit4();
                            oTable4.Init($("#modelTableLook"));
                        }
                    }
                });
            })
        },
        rootMultipleArr:function(proArr,code,type){
            var arr=[];
            var codeArr=[];
            if(code){
                codeArr=code.split(",");
            }
            if(type==1){//如果type=1则是班组else则是状态
                for(var i=0;i<codeArr.length;i++){
                    arr.push(bs.getXInY(proArr,"name","value",codeArr[i]));
                }
            }else{
                for(var i=0;i<codeArr.length;i++){
                    arr.push(bs.changeState(codeArr[i],proArr));
                }
            }
            return arr;
        },
        closeSelectModel:function(){
            $(".closeSelectModel").on("click",function(){
                tools.modelSelectArr = bs.objArrDeepCopy(tools.nowSelectArr)
            })
        }
    };
    var draggables = { //模态框拖动
        init: function () {
            this.draggable($('#addModal'));
        },
        draggable: function (obj) {
            $(obj).draggable();
        }
    };
    var menu = {
        init: function (area) {
            menu.render(area);
            menu.changeMenu();
            menu.search();
        },
        render: function (area) {
            var jstree = $("#jstree");
            jstree.jstree("destroy");
            jstree.data('jstree', false).empty();
            jstree.jstree({
                "core": {
                    "animation": false,
                    "multiple": false,
                    "check_callback": true,
                    'data': function (obj, callback) {
                        var jsonstr = "[]";
                        var jsonarray = eval('(' + jsonstr + ')');
                        var arr1=[];
                        $.ajax({
                            type: "GET",
                            url: basePath + 'rest/model/select/modelTypeTree',
                            dataType: "json",
                            data:{
                                "provinceCode":area
                            },
                            success: function (data) {
                                var result=data.data;
                                if (result != null) {
                                    var arr = [];
                                    arr.push(result);
                                    callback.call(this, menu.loopMenu(arr));
                                }
                            }
                        });
                    }
                },
                "types": {
                    "default": {
                        "icon": "jstree-folder"
                    },
                    "html": {
                        "icon": "jstree-file"
                    }
                },
                "plugins": ["types", "search", "unique"]
            }).bind('loaded.jstree', function (e, data) {
                jstree.jstree("deselect_all", true);
                $("li[aria-selected='true']").click();
            })
        },
        rootLoopMenu:function(array,obj){
            if (array.length > 0) {
                var parentid=obj.parentid;
                for (var i = 0; i < array.length; i++) {
                    var code=0;
                    var id = array[i]["id"];
                    if(parentid==id){
                        array[i]["children"].push(obj);
                        return array;
                    }else{
                        code++;
                    }
                    if(code==array.length){
                        for(var j=0;j<code;j++){
                            menu.rootLoopMenu(array[j]["children"],obj);
                        }
                    }
                }
                return array;
            }
        },
        loopMenu: function (array) {
            if (array && array.length > 0) {
                for (var i = 0; i < array.length; i++) {
                    var children = array[i]["children"];
                    if (children.length <= 0) {
                        array[i].type = "html"
                    } else {
//                        if(i<=1){
                        array[i].state = {"opened": "true"}
//                        }
                    }
                    if (children) {
                        menu.loopMenu(children);
                    }
                }
                return array;
            }else{
                return []
            }
        },
        changeMenu: function () {
            $('#jstree').on("changed.jstree", function (e, data) {
                if(data.selected ==-9999){
                    $("#classify").val("");
                }else{
                    if (data.selected < 0) {
                        $("#classify").val("");
                        $("#proSelectModal").val(bs.getXInY(tools.proArr, "value", "id", Math.abs(data.selected)));
                    } else {
                        $("#classify").val(data.selected);
                    }
                }
                $("#modelTableWin").bootstrapTable('refresh');
            });
        },
        search: function () {
            $("#searchMenu").on("click", function () {
                $("#jstree").jstree(true).search($(".search_box input").val());
            });
            $("#searchMenu").prev().on("keyup", function (e) {
                var code = e.charCode || e.keyCode;
                if (code == 13) {
                    $("#jstree").jstree(true).search($("#searchMenu").prev().val());
                }
            })
        },
    };
    //校验
    var validateFun = {
        init: function () {
            this.initKeyValidatorAdd();
            this.initKeyValidatorEdit();
        },
        initKeyValidatorAdd: function () {
            $("#addForm").jqxValidator({
                rules: [
                    {
                        input: '#proModalAddInput',
                        message: '请选择省份!',
                        action: 'change,blur',
                        rule: function (input, commit) {
                            var result = true;
                            if ($(input).val() == "") {
                                result = false
                            }
                            return result;
                        }
                    }
                    , {
                        input: '#workNameAdd',
                        message: '专项质检名称不能为空!',
                        action: 'keyup,blur',
                        rule: 'required'
                    }
                    , {
                        input: '#workNameAdd',
                        message: '名称不能包含空格!',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result = true;
                            if ($(input).val().indexOf(" ") >-1) {
                                result = false
                            }
                            return result;
                        }
                    }
                    , {
                        input: '#workNameAdd',
                        message: "任务名称已经存在!",
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var validate = true;
                            var url = basePath + "rest/per-task/work-uniqueness";
                            var data = {
                                id: '',
                                workName: $(input).val(),
                                workType:"1"
                            };
                            $.ajax({
                                url: url, data: data, timeout: 10000,
                                async: false, type: 'POST',
                                success: function (msg) {
                                    if (msg.code<0) {
                                        input.focus();
                                        validate = false;
                                    }
                                }
                            });
                            return validate;
                        }
                    },
                    {
                        input: '#workNameAdd',
                        message: '最多输入'+tools.maxTextLength+'个字符！',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result = true;
                            if ($(input).val()!= "") {
                                if($(input).val().length>50){
                                    return false
                                }
                            }
                            return result;
                        }
                    }
                    , {
                        input: '#timeModalAddInput',
                        message: '通话时间不能为空',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result = true;
                            if ($("#startTimeAdd").val() == "" || $("#endTimeAdd").val() == "") {
                                result = false
                            }
                            return result;
                        }
                    }
                    , {
                        input: '#customerNumAdd',
                        message: '请输入正确的客户号码,支持逗号隔开！',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result=true;
                            var val=$(input).val();
                            if((val&&val!="")){
                                var reg=/^([a-zA-Z0-9_-]{1,20})( *, *([a-zA-Z0-9_-]{1,20})){0,199}$/;//支持输入除空格逗号之外的字符
                                if(!reg.test(val)){
                                    result= false;
                                }
                            }
                            return result;
                        }
                    }
                    , {
                        input: '#seatIdModalAdd',
                        message: '请输入正确的坐席工号,支持逗号隔开！',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result=true;
                            var val=$(input).val();
                            if((val&&val!="")){
                                var reg=/^([a-zA-Z0-9]{1,20})( *, *([a-zA-Z0-9]{1,20})){0,199}$/;//支持输入除空格逗号之外的字符
                                if(!reg.test(val)){
                                    result= false;
                                }
                            }
                            return result;
                        }
                    }
                    , {
                        input: '#serialNumberAdd',
                        message: '请输入正确的录音流水号,支持逗号隔开！',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result=true;
                            var val=$(input).val();
                            if((val&&val!="")){
                                var reg=/^([a-zA-Z0-9_-]{1,50})( *, *([a-zA-Z0-9_-]{1,50})){0,99}$/;//支持输入除空格逗号之外的字符
                                if(!reg.test(val)){
                                    result= false;
                                }
                            }
                            return result;
                        }
                    }
                    , {
                        input: '#durMin',
                        message: '请输入大于等于0、小于等于10000的数字!',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result = true;
                            var val = $.trim($(input).val());
                            if (val!= "") {
                                if ((!(/^\d+(\.\d+)?$/.test(val)))|| (parseFloat(val)>10000)) {
                                    result = false;
                                    $(input).focus();
                                }
                            }
                            return result;
                        },
                        hintRender:function(message, input){
                            var box=$(input).parent();
                            if(box.find("label").length>0){
                                box.find("label").remove();
                            }
                            var label=$("<label class='jqx-validator-error-label' style='width:280px;'>" + message + "</label>");
                            label.appendTo(box);
                            return label
                        }
                    } , {
                        input: '#durMin',
                        message: '通话时长上限不得小于通话时长下限',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result = true;
                            var val = $(input).val();
                            validateFun.durMax=$("#durMax").val();
                            if (val!= ""&&$("#durMax").val()!="") {
                                if (parseFloat(val)>parseFloat($("#durMax").val())) {
                                    result = false;
                                    $(input).focus();
                                }
                            }
                            return result;
                        },
                        hintRender:function(message, input){
                            var box=$(input).parent();
                            if(box.find("label").length>0){
                                box.find("label").remove();
                            }
//                            message=message+validateFun.durMax;
                            var label=$("<label class='jqx-validator-error-label' style='width:280px;'>" + message + "</label>");
                            label.appendTo(box);
                            return  label;
                        }
                    }, {
                        input: '#durMax',
                        message: '请输入大于等于0、小于等于10000的数字',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result = true;
                            var val = $.trim($(input).val());
                            if (val!= "") {
                                if (!((/^\d+(\.\d+)?$/.test(val))) || (parseFloat(val)>10000)) {
                                    result = false;
                                    $(input).focus();
                                }
                            }
                            return result;
                        },
                        hintRender:function(message, input){
                            var box=$(input).parent();
                            if(box.find("label").length>0){
                                box.find("label").remove();
                            }
                            var label=$("<label class='jqx-validator-error-label' style='width:280px;'>" + message + "</label>");
                            label.appendTo(box);
                            return label
                        }
                    }, {
                        input: '#durMax',
                        message: '通话时长上限不得小于通话时长下限',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result = true;
                            var val = $(input).val();
                            validateFun.durMin=$("#durMin").val();
                            if (val!= ""&&$("#durMin").val()!="") {
                                if (parseFloat(val)<parseFloat($("#durMin").val())) {
                                    result = false;
                                    $(input).focus();
                                }
                            }
                            return result;
                        },
                        hintRender:function(message, input){
                            var box=$(input).parent();
                            if(box.find("label").length>0){
                                box.find("label").remove();
                            }
//                            message=message+validateFun.durMin;
                            var label=$("<label class='jqx-validator-error-label' style='width:280px;'>" + message + "</label>");
                            label.appendTo(box);
                            return  label;
                        }
                    },
                    {
                        input: '#descriptionAdd',
                        message: '最多输入255个字符!',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result = true;
                            if ($(input).val() != "") {
                                if ($(input).val().length > 255) {
                                    result = false
                                }
                            }
                            if(result){
                                $(input).removeClass("jqx-validator-error-element");
                            }
                            return result;
                        }
                    }

                ],
                hintType: "label"
            });
        },
        initKeyValidatorEdit: function () {
            $("#editForm").jqxValidator({
                rules: [
                    {
                        input: '#proModalEditInput',
                        message: '请选择省份!',
                        action: 'change,blur',
                        rule: function (input, commit) {
                            var result = true;
                            if ($(input).val() == "") {
                                result = false
                            }
                            return result;
                        }
                    }
                    , {
                        input: '#workNameEdit',
                        message: '专项质检名称不能为空',
                        action: 'keyup,blur',
                        rule: 'required'
                    }
                    , {
                        input: '#workNameEdit',
                        message: '名称不能包含空格!',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result = true;
                            if ($(input).val().indexOf(" ") >-1) {
                                result = false
                            }
                            return result;
                        }
                    }
                    , {
                        input: '#workNameEdit',
                        message: "任务名称已经存在!",
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var validate = true;
                            var url = basePath + "rest/per-task/work-uniqueness";
                            var data = {
                                id:  $("#editModal").attr("data-id"),
                                workName: $(input).val(),
                                workType:"1"
                            };
                            $.ajax({
                                url: url, data: data, timeout: 10000,
                                async: false, type: 'POST',
                                success: function (msg) {
                                    if (msg.code<0) {
                                        input.focus();
                                        validate = false;
                                    }
                                }
                            });
                            return validate;
                        }
                    }
                    ,
                    {
                        input: '#workNameEdit',
                        message: '最多输入'+tools.maxTextLength+'个字符！',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result = true;
                            if ($(input).val()!= "") {
                                if($(input).val().length>50){
                                    return false
                                }
                            }
                            return result;
                        }
                    }
                    , {
                        input: '#customerNumEdit',
                        message: '请输入正确的客户号码,支持逗号隔开！',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result=true;
                            var val=$(input).val();
                            if((val&&val!="")){
                                var reg=/^([a-zA-Z0-9_-]{1,20})( *, *([a-zA-Z0-9_-]{1,20})){0,199}$/;//支持输入除空格逗号之外的字符
                                if(!reg.test(val)){
                                    result= false;
                                }
                            }
                            return result;
                        }
                    }
                    , {
                        input: '#seatIdModalEdit',
                        message: '请输入正确的坐席工号,支持逗号隔开！',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result=true;
                            var val=$(input).val();
                            if((val&&val!="")){
                                var reg=/^([a-zA-Z0-9]{1,20})( *, *([a-zA-Z0-9]{1,20})){0,199}$/;//支持输入除空格逗号之外的字符
                                if(!reg.test(val)){
                                    result= false;
                                }
                            }
                            return result;
                        }
                    }
                    , {
                        input: '#serialNumberEdit',
                        message: '请输入正确的录音流水号,支持逗号隔开！',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result=true;
                            var val=$(input).val();
                            if((val&&val!="")){
                                var reg=/^([a-zA-Z0-9_-]{1,50})(,([a-zA-Z0-9_-]{1,50})){0,99}$/;//支持输入除空格逗号之外的字符
                                if(!reg.test(val)){
                                    result= false;
                                }
                            }
                            return result;
                        }
                    }
                    , {
                        input: '#timeModalEditInput',
                        message: '考核周期不能为空',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result = true;
                            if ($("#startTimeEdit").val() == "" || $("#endTimeEdit").val() == "") {
                                result = false
                            }
                            return result;
                        }
                    }
                    , {
                        input: '#durMinEdit',
                        message: '请输入大于等于0、小于等于10000的数字',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result = true;
                            var val = $.trim($(input).val());
                            if (val!= "") {
                                if (!((/^\d+(\.\d+)?$/.test(val))) || (parseFloat(val)>10000)) {
                                    result = false;
                                    $(input).focus();
                                }
                            }
                            return result;
                        },
                        hintRender:function(message, input){
                            var box=$(input).parent();
                            if(box.find("label").length>0){
                                box.find("label").remove();
                            }
                            var label=$("<label class='jqx-validator-error-label' style='width:280px;'>" + message + "</label>");
                            label.appendTo(box);
                            return label
                        }
                    } , {
                        input: '#durMinEdit',
                        message: '通话时长上限不得小于通话时长下限',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result = true;
                            var val = $(input).val();
                            validateFun.durMax=$("#durMaxEdit").val();
                            if (val!= ""&&$("#durMaxEdit").val()!="") {
                                if (parseFloat(val)>parseFloat($("#durMaxEdit").val())) {
                                    result = false;
                                    $(input).focus();
                                }
                            }
                            return result;
                        },
                        hintRender:function(message, input){
                            var box=$(input).parent();
                            if(box.find("label").length>0){
                                box.find("label").remove();
                            }
//                            message=message+validateFun.durMax;
                            var label=$("<label class='jqx-validator-error-label' style='width:280px;'>" + message + "</label>");
                            label.appendTo(box);
                            return  label;
                        }
                    }, {
                        input: '#durMaxEdit',
                        message: '请输入大于等于0、小于等于10000的数字',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result = true;
                            var val = $.trim($(input).val());
                            if (val!= "") {
                                if (!((/^\d+(\.\d+)?$/.test(val))) || (parseFloat(val)>10000)) {
                                    result = false;
                                    $(input).focus();
                                }
                            }
                            return result;
                        },
                        hintRender:function(message, input){
                            var box=$(input).parent();
                            if(box.find("label").length>0){
                                box.find("label").remove();
                            }
                            var label=$("<label class='jqx-validator-error-label' style='width:280px;'>" + message + "</label>");
                            label.appendTo(box);
                            return label
                        }
                    }, {
                        input: '#durMaxEdit',
                        message: '通话时长上限不得小于通话时长下限',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result = true;
                            var val = $(input).val();
                            validateFun.durMin=$("#durMinEdit").val();
                            if (val!= ""&&$("#durMinEdit").val()!="") {
                                if (parseFloat(val)<parseFloat($("#durMinEdit").val())) {
                                    result = false;
                                    $(input).focus();
                                }
                            }
                            return result;
                        },
                        hintRender:function(message, input){
                            var box=$(input).parent();
                            if(box.find("label").length>0){
                                box.find("label").remove();
                            }
//                            message=message+validateFun.durMin;
                            var label=$("<label class='jqx-validator-error-label' style='width:280px;'>" + message + "</label>");
                            label.appendTo(box);
                            return  label;
                        }
                    },
                    {
                        input: '#descriptionEdit',
                        message: '最多输入255个字符!',
                        action: 'keyup,blur',
                        rule: function (input, commit) {
                            var result = true;
                            if ($(input).val() != "") {
                                if ($(input).val().length > 255) {
                                    result = false
                                }
                            }
                            if(result){
                                $(input).removeClass("jqx-validator-error-element");
                            }
                            return result;
                        }
                    }

                ],
                hintType: "label"
            });
        },
    };
    $(function () {
        resize.init();
        draggables.init();
        tools.init();
        validateFun.init();
        var oTable = new TableInit();
        oTable.Init();
        var oTable1 = new TableInit1();
        oTable1.Init();
        var oTable2 = new TableInit2();
        oTable2.Init();
        var oTable3 = new TableInit3();
        oTable3.Init();
        var oTable4 = new TableInit4();
        oTable4.Init($("#modelTableEdit"));
        tag.init(null,null,null,null,true);// true代表不显示关系
    })
</script>
</body>
</html>